/**
  * @param string $pattern
  * @param array  $tokens
  * @param int    $weight
  *
  * @dataProvider providePatternAndDecomposition
  */
 public function testSetPattern($pattern, array $tokens, $weight)
 {
     $this->document->setPattern($pattern);
     foreach ($tokens as $key => $token) {
         $tokenGetter = 'getToken' . $key;
         $this->assertSame($token, $this->document->{$tokenGetter}());
     }
     $this->assertSame($pattern, $this->document->getPattern());
     $this->assertEquals($weight, $this->document->getWeight());
 }
 /**
  * Load data fixtures with the passed EntityManager
  *
  * @param ObjectManager $manager
  */
 public function load(ObjectManager $manager)
 {
     $patterns = array('foo', 'foo/{bar}', 'foo/bar', 'baz/bar', 'foo/{bar}/baz', 'zero/one/two/three/four/five/six/{seven}/eight/nine/ten/eleven', 'zero/one/two/three/four/five/six/{seven}/eight/nine/ten/{eleven}/twelve', 'zero/one/two/three/four/five/six/{seven}/eight/nine/ten/eleven/twelve', 'zero/one/two/three/four/five/six/{seven}/eight/nine/ten/eleven/{twelve}');
     foreach ($patterns as $pattern) {
         $route = new RouteDocument();
         $route->setName($pattern);
         $route->setPattern($pattern);
         $manager->persist($route);
     }
     $manager->flush();
 }
 /**
  * @param ObjectManager $manager
  * @param NodeInterface $node
  */
 protected function generateRouteNode(ObjectManager $manager, $node)
 {
     $site = $this->getReference('site3');
     foreach ($site->getAliases() as $key => $alias) {
         if ($alias->getLanguage() == $node->getLanguage()) {
             $route = new RouteDocument();
             $route->setName($key . '_' . $node->getId());
             $route->setHost($alias->getDomain());
             $scheme = $alias->getScheme();
             $route->setSchemes($scheme);
             $route->setLanguage($node->getLanguage());
             $route->setNodeId($node->getNodeId());
             $route->setSiteId($site->getSiteId());
             $route->setAliasId($key);
             $route->setPattern($node->getRoutePattern());
             $manager->persist($route);
         }
     }
 }