|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the Symfony CMF package. |
| 5 | + * |
| 6 | + * (c) 2011-2013 Symfony CMF |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | + |
| 13 | +namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\DependencyInjection; |
| 14 | + |
| 15 | +use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\CmfRoutingExtension; |
| 16 | +use Symfony\Cmf\Bundle\RoutingBundle\DependencyInjection\Configuration; |
| 17 | +use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionConfigurationTestCase; |
| 18 | + |
| 19 | +class ConfigurationTest extends AbstractExtensionConfigurationTestCase |
| 20 | +{ |
| 21 | + protected function getContainerExtension() |
| 22 | + { |
| 23 | + return new CmfRoutingExtension(); |
| 24 | + } |
| 25 | + |
| 26 | + protected function getConfiguration() |
| 27 | + { |
| 28 | + return new Configuration(); |
| 29 | + } |
| 30 | + |
| 31 | + public function testSupportsAllConfigFormats() |
| 32 | + { |
| 33 | + $expectedConfiguration = array( |
| 34 | + 'chain' => array( |
| 35 | + 'routers_by_id' => array( |
| 36 | + 'cmf_routing.router' => 300, |
| 37 | + 'router.default' => 100, |
| 38 | + ), |
| 39 | + 'replace_symfony_router' => true, |
| 40 | + ), |
| 41 | + 'dynamic' => array( |
| 42 | + 'generic_controller' => 'acme_main.controller:mainAction', |
| 43 | + 'controllers_by_type' => array( |
| 44 | + 'editable' => 'acme_main.some_controller:editableAction', |
| 45 | + ), |
| 46 | + 'controllers_by_class' => array( |
| 47 | + 'Symfony\Cmf\Bundle\ContentBundle\Document\StaticContent' => 'cmf_content.controller:indexAction', |
| 48 | + ), |
| 49 | + 'templates_by_class' => array( |
| 50 | + 'Symfony\Cmf\Bundle\ContentBundle\Document\StaticContent' => 'CmfContentBundle:StaticContent:index.html.twig', |
| 51 | + ), |
| 52 | + 'persistence' => array( |
| 53 | + 'phpcr' => array( |
| 54 | + 'enabled' => true, |
| 55 | + 'route_basepath' => '/cms/routes', |
| 56 | + 'content_basepath' => '/cms/content', |
| 57 | + 'manager_name' => null, |
| 58 | + 'use_sonata_admin' => false, |
| 59 | + ), |
| 60 | + 'orm' => array( |
| 61 | + 'enabled' => false, |
| 62 | + 'manager_name' => null, |
| 63 | + ), |
| 64 | + ), |
| 65 | + 'enabled' => true, |
| 66 | + 'default_controller' => null, |
| 67 | + 'uri_filter_regexp' => '', |
| 68 | + 'route_filters_by_id' => array(), |
| 69 | + 'locales' => array('en', 'fr'), |
| 70 | + ), |
| 71 | + ); |
| 72 | + |
| 73 | + $formats = array_map(function ($path) { |
| 74 | + return __DIR__.'/../../Resources/Fixtures/'.$path; |
| 75 | + }, array( |
| 76 | + 'config/config.yml', |
| 77 | + 'config/config.xml', |
| 78 | + 'config/config.php', |
| 79 | + )); |
| 80 | + |
| 81 | + foreach ($formats as $format) { |
| 82 | + $this->assertProcessedConfigurationEquals($expectedConfiguration, array($format)); |
| 83 | + } |
| 84 | + } |
| 85 | +} |
0 commit comments