Ejemplo n.º 1
0
 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 RouterCollection([$router1, $router2, $router3]);
     $this->assertSame('(/foo/bar/(?:\\d+))|(/foo/(?=bar/))|(/foo/\\(bar\\))', $router->getPattern());
 }
Ejemplo n.º 2
0
 /**
  * Create this instance from given routers.
  *
  * @param RouterInterface[] $routers
  */
 public function __construct(array $routers)
 {
     parent::__construct($routers);
     $this->pattern = parent::getPattern();
 }