/** * @test * @expectedException \TYPO3\Flow\Mvc\Exception\InvalidRouteSetupException */ public function createRoutesFromConfigurationThrowsExceptionIfOnlySomeRoutesWithTheSameUriPatternHaveHttpMethodConstraints() { $routesConfiguration = array(array('uriPattern' => 'somePattern'), array('uriPattern' => 'somePattern', 'httpMethods' => array('POST', 'PUT'))); shuffle($routesConfiguration); $this->router->setRoutesConfiguration($routesConfiguration); $this->router->_call('createRoutesFromConfiguration'); }
/** * @test */ public function findMatchResultsSetsLastMatchedRoute() { $mockHttpRequest = $this->getMockBuilder('TYPO3\\Flow\\Http\\Request')->disableOriginalConstructor()->getMock(); $mockRoute1 = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Routing\\Route')->getMock(); $mockRoute1->expects($this->once())->method('matches')->with($mockHttpRequest)->will($this->returnValue(FALSE)); $mockRoute2 = $this->getMockBuilder('TYPO3\\Flow\\Mvc\\Routing\\Route')->getMock(); $mockRoute2->expects($this->once())->method('matches')->with($mockHttpRequest)->will($this->returnValue(TRUE)); $this->router->_set('routes', array($mockRoute1, $mockRoute2)); $this->router->_call('findMatchResults', $mockHttpRequest); $this->assertSame($mockRoute2, $this->router->getLastMatchedRoute()); }