You are here

public function YamlFileLoaderTest::testLoadWithResource in Zircon Profile 8

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

File

vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php, line 112

Class

YamlFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

public function testLoadWithResource() {
  $loader = new YamlFileLoader(new FileLocator(array(
    __DIR__ . '/../Fixtures',
  )));
  $routeCollection = $loader
    ->load('validresource.yml');
  $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());
  }
}