You are here

public function XmlFileLoaderTest::testLoadWithImport in Zircon Profile 8.0

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

File

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

Class

XmlFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

public function testLoadWithImport() {
  $loader = new XmlFileLoader(new FileLocator(array(
    __DIR__ . '/../Fixtures',
  )));
  $routeCollection = $loader
    ->load('validresource.xml');
  $routes = $routeCollection
    ->all();
  $this
    ->assertCount(2, $routes, 'Two routes are loaded');
  $this
    ->assertContainsOnly('Symfony\\Component\\Routing\\Route', $routes);
  foreach ($routes as $route) {
    $this
      ->assertSame('/{foo}/blog/{slug}', $route
      ->getPath());
    $this
      ->assertSame('123', $route
      ->getDefault('foo'));
    $this
      ->assertSame('\\d+', $route
      ->getRequirement('foo'));
    $this
      ->assertSame('bar', $route
      ->getOption('foo'));
    $this
      ->assertSame('', $route
      ->getHost());
    $this
      ->assertSame('context.getMethod() == "POST"', $route
      ->getCondition());
  }
}