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()); }
/** * Create this instance from given routers. * * @param RouterInterface[] $routers */ public function __construct(array $routers) { parent::__construct($routers); $this->pattern = parent::getPattern(); }