You are here

public function YamlFileLoaderTest::testLoadWithRoute 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::testLoadWithRoute()

File

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

Class

YamlFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

public function testLoadWithRoute() {
  $loader = new YamlFileLoader(new FileLocator(array(
    __DIR__ . '/../Fixtures',
  )));
  $routeCollection = $loader
    ->load('validpattern.yml');
  $route = $routeCollection
    ->get('blog_show');
  $this
    ->assertInstanceOf('Symfony\\Component\\Routing\\Route', $route);
  $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('locale'));
  $this
    ->assertSame('RouteCompiler', $route
    ->getOption('compiler_class'));
  $this
    ->assertEquals(array(
    'GET',
    'POST',
    'PUT',
    'OPTIONS',
  ), $route
    ->getMethods());
  $this
    ->assertEquals(array(
    'https',
  ), $route
    ->getSchemes());
  $this
    ->assertEquals('context.getMethod() == "GET"', $route
    ->getCondition());
}