Example #1
0
 public function testGenerateUniqueRoute()
 {
     $routeManager = new MockRouteManager();
     $generator = new RouteGenerator($routeManager);
     $mockRoute = new MockRoute();
     $mockRoute->setName('test');
     $mockRoute->setRoutePattern($generator->generateRouteFromText('Kiškis ėjo takeliu ir sutiko mešką'));
     $this->assertEquals('/kiskis-ejo-takeliu-ir-sutiko-meska', $generator->generateUniqueRoute($mockRoute)->getRoutePattern());
     $route = $routeManager->create();
     $route->setRoutePattern('kiskis-ejo-takeliu-ir-sutiko-meska');
     $routeManager->add($route);
     $mockRoute->setRoutePattern($generator->generateRouteFromText('Kiškis ėjo takeliu ir sutiko mešką/.'));
     $this->assertEquals('/kiskis-ejo-takeliu-ir-sutiko-meska-1', $generator->generateUniqueRoute($mockRoute)->getRoutePattern());
     $route = $routeManager->create();
     $route->setRoutePattern('kiskis-ejo-takeliu-ir-sutiko-meska-1');
     $routeManager->add($route);
     $mockRoute->setRoutePattern($generator->generateRouteFromText('Kiškis ėjo takeliu ir sutiko mešką/.'));
     $this->assertEquals('/kiskis-ejo-takeliu-ir-sutiko-meska-2', $generator->generateUniqueRoute($mockRoute)->getRoutePattern());
 }
 /**
  * @expectedException \Tadcka\Component\Routing\Exception\RoutingRuntimeException
  */
 public function testAddMethodWithEmptyName()
 {
     $this->inMemoryManager->add($this->mockManager->create());
 }