public function testGetPattern()
 {
     $router1 = $this->getMock('Emonkak\\Waf\\Routing\\RouterInterface');
     $router1->expects($this->once())->method('getPattern')->willReturn('/foo/bar/(\\d+)');
     $router2 = $this->getMock('Emonkak\\Waf\\Routing\\RouterInterface');
     $router2->expects($this->once())->method('getPattern')->willReturn('/foo/(?=bar/)');
     $router3 = $this->getMock('Emonkak\\Waf\\Routing\\RouterInterface');
     $router3->expects($this->once())->method('getPattern')->willReturn('/foo/\\(bar\\)');
     $router = new OptimizedRouterCollection([$router1, $router2, $router3]);
     $this->assertSame('(/foo/bar/(?:\\d+))|(/foo/(?=bar/))|(/foo/\\(bar\\))', $router->getPattern());
 }
Esempio n. 2
0
 /**
  * @iterations 1000
  */
 public function optimizedRouterCollectionWithConstructor()
 {
     $optimizedRouterCollection = new OptimizedRouterCollection($this->routers);
     $match = $optimizedRouterCollection->match($this->request);
     assert($match !== null);
 }