Neos\Flow\Tests\Unit\Mvc\Routing\RouterTest::routeSetsLastMatchedRoute PHP Method

routeSetsLastMatchedRoute() public method

    public function routeSetsLastMatchedRoute()
    {
        $router = $this->getAccessibleMock(Router::class, ['createRoutesFromConfiguration']);
        $this->inject($router, 'routerCachingService', $this->mockRouterCachingService);
        $this->inject($router, 'systemLogger', $this->mockSystemLogger);
        $mockHttpRequest = $this->getMockBuilder(Request::class)->disableOriginalConstructor()->getMock();
        $mockRoute1 = $this->getMockBuilder(Route::class)->getMock();
        $mockRoute1->expects($this->once())->method('matches')->with($mockHttpRequest)->will($this->returnValue(false));
        $mockRoute2 = $this->getMockBuilder(Route::class)->getMock();
        $mockRoute2->expects($this->once())->method('matches')->with($mockHttpRequest)->will($this->returnValue(true));
        $router->_set('routes', [$mockRoute1, $mockRoute2]);
        $router->route($mockHttpRequest);
        $this->assertSame($mockRoute2, $router->getLastMatchedRoute());
    }