You are here

public function DumperPrefixCollectionTest::testMergeSlashNodes in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php \Symfony\Component\Routing\Tests\Matcher\Dumper\DumperPrefixCollectionTest::testMergeSlashNodes()

File

vendor/symfony/routing/Tests/Matcher/Dumper/DumperPrefixCollectionTest.php, line 67

Class

DumperPrefixCollectionTest

Namespace

Symfony\Component\Routing\Tests\Matcher\Dumper

Code

public function testMergeSlashNodes() {
  $coll = new DumperPrefixCollection();
  $coll
    ->setPrefix('');
  $route = new DumperRoute('bar', new Route('/foo/bar'));
  $coll = $coll
    ->addPrefixRoute($route);
  $route = new DumperRoute('bar2', new Route('/foo/bar'));
  $coll = $coll
    ->addPrefixRoute($route);
  $route = new DumperRoute('qux', new Route('/foo/qux'));
  $coll = $coll
    ->addPrefixRoute($route);
  $route = new DumperRoute('bar3', new Route('/foo/bar'));
  $result = $coll
    ->addPrefixRoute($route);
  $result
    ->getRoot()
    ->mergeSlashNodes();
  $expect = <<<'EOF'
            |-coll /f
            | |-coll /fo
            | | |-coll /foo
            | | | |-coll /foo/b
            | | | | |-coll /foo/ba
            | | | | | |-coll /foo/bar
            | | | | | | |-route bar /foo/bar
            | | | | | | |-route bar2 /foo/bar
            | | | |-coll /foo/q
            | | | | |-coll /foo/qu
            | | | | | |-coll /foo/qux
            | | | | | | |-route qux /foo/qux
            | | | |-coll /foo/b
            | | | | |-coll /foo/ba
            | | | | | |-coll /foo/bar
            | | | | | | |-route bar3 /foo/bar

EOF;
  $this
    ->assertSame($expect, $this
    ->collectionToString($result
    ->getRoot(), '            '));
}