public function XmlFileLoaderTest::testLoadWithRoute

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php, line 38

Class

XmlFileLoaderTest

Namespace

Symfony\Component\Routing\Tests\Loader

Code

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