eZ\Publish\Core\MVC\Symfony\Routing\Tests\UrlAliasRouterTest::testMatchRequestLocationWithCaseRedirect PHP Method

testMatchRequestLocationWithCaseRedirect() public method

    public function testMatchRequestLocationWithCaseRedirect()
    {
        $pathInfo = '/Foo/bAR';
        $urlAliasPath = '/foo/bar';
        $destinationId = 123;
        $urlAlias = new URLAlias(array('path' => $urlAliasPath, 'type' => UrlAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false));
        $request = $this->getRequestByPathInfo($pathInfo);
        $this->urlALiasGenerator->expects($this->once())->method('isUriPrefixExcluded')->with($pathInfo)->will($this->returnValue(false));
        $this->urlAliasService->expects($this->once())->method('lookup')->with($pathInfo)->will($this->returnValue($urlAlias));
        $this->urlALiasGenerator->expects($this->once())->method('loadLocation')->will($this->returnValue(new Location(array('contentInfo' => new ContentInfo(array('id' => 456))))));
        $expected = array('_route' => UrlAliasRouter::URL_ALIAS_ROUTE_NAME, '_controller' => UrlAliasRouter::VIEW_ACTION, 'locationId' => $destinationId, 'contentId' => 456, 'viewType' => ViewManager::VIEW_TYPE_FULL, 'layout' => true);
        $this->assertEquals($expected, $this->router->matchRequest($request));
        $this->assertTrue($request->attributes->get('needsRedirect'));
        $this->assertSame($urlAliasPath, $request->attributes->get('semanticPathinfo'));
        $this->assertSame($destinationId, $request->attributes->get('locationId'));
    }