You are here

public function ChainRouterTest::testRouteCollection in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony-cmf/routing/Tests/Routing/ChainRouterTest.php \Symfony\Cmf\Component\Routing\Tests\Routing\ChainRouterTest::testRouteCollection()

File

vendor/symfony-cmf/routing/Tests/Routing/ChainRouterTest.php, line 650

Class

ChainRouterTest

Namespace

Symfony\Cmf\Component\Routing\Tests\Routing

Code

public function testRouteCollection() {
  list($low, $high) = $this
    ->createRouterMocks();
  $lowcol = new RouteCollection();
  $lowcol
    ->add('low', $this
    ->buildMock('Symfony\\Component\\Routing\\Route'));
  $highcol = new RouteCollection();
  $highcol
    ->add('high', $this
    ->buildMock('Symfony\\Component\\Routing\\Route'));
  $low
    ->expects($this
    ->once())
    ->method('getRouteCollection')
    ->will($this
    ->returnValue($lowcol));
  $high
    ->expects($this
    ->once())
    ->method('getRouteCollection')
    ->will($this
    ->returnValue($highcol));
  $this->router
    ->add($low, 10);
  $this->router
    ->add($high, 100);
  $collection = $this->router
    ->getRouteCollection();
  $this
    ->assertInstanceOf('Symfony\\Component\\Routing\\RouteCollection', $collection);
  $names = array();
  foreach ($collection
    ->all() as $name => $route) {
    $this
      ->assertInstanceOf('Symfony\\Component\\Routing\\Route', $route);
    $names[] = $name;
  }
  $this
    ->assertEquals(array(
    'high',
    'low',
  ), $names);
}