You are here

public function XmlFileLoaderTest::testLoadWithNamespacePrefix in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\Routing\Tests\Loader\XmlFileLoaderTest::testLoadWithNamespacePrefix()

File

vendor/symfony/routing/Tests/Loader/XmlFileLoaderTest.php, line 68

Class

XmlFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

public function testLoadWithNamespacePrefix() {
  $loader = new XmlFileLoader(new FileLocator(array(
    __DIR__ . '/../Fixtures',
  )));
  $routeCollection = $loader
    ->load('namespaceprefix.xml');
  $this
    ->assertCount(1, $routeCollection
    ->all(), 'One route is loaded');
  $route = $routeCollection
    ->get('blog_show');
  $this
    ->assertSame('/blog/{slug}', $route
    ->getPath());
  $this
    ->assertSame('{_locale}.example.com', $route
    ->getHost());
  $this
    ->assertSame('MyBundle:Blog:show', $route
    ->getDefault('_controller'));
  $this
    ->assertSame('\\w+', $route
    ->getRequirement('slug'));
  $this
    ->assertSame('en|fr|de', $route
    ->getRequirement('_locale'));
  $this
    ->assertNull($route
    ->getDefault('slug'));
  $this
    ->assertSame('RouteCompiler', $route
    ->getOption('compiler_class'));
}