You are here

public function PhpFileLoaderTest::testLoadWithImport in Zircon Profile 8.0

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

File

vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php, line 49

Class

PhpFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

public function testLoadWithImport() {
  $loader = new PhpFileLoader(new FileLocator(array(
    __DIR__ . '/../Fixtures',
  )));
  $routeCollection = $loader
    ->load('validresource.php');
  $routes = $routeCollection
    ->all();
  $this
    ->assertCount(1, $routes, 'One route is loaded');
  $this
    ->assertContainsOnly('Symfony\\Component\\Routing\\Route', $routes);
  foreach ($routes as $route) {
    $this
      ->assertSame('/prefix/blog/{slug}', $route
      ->getPath());
    $this
      ->assertSame('MyBlogBundle:Blog:show', $route
      ->getDefault('_controller'));
    $this
      ->assertSame('{locale}.example.com', $route
      ->getHost());
    $this
      ->assertSame('RouteCompiler', $route
      ->getOption('compiler_class'));
    $this
      ->assertEquals(array(
      'GET',
      'POST',
      'PUT',
      'OPTIONS',
    ), $route
      ->getMethods());
    $this
      ->assertEquals(array(
      'https',
    ), $route
      ->getSchemes());
  }
}