public function testMatchRequestLocationCustomForward()
{
$pathInfo = '/foo/bar';
$newPathInfo = '/foo/bar-new';
$destinationId = 123;
$destinationLocation = new Location(array('id' => $destinationId, 'contentInfo' => new ContentInfo(array('id' => 456))));
$urlAlias = new URLAlias(array('path' => $pathInfo, 'type' => UrlAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false, 'isCustom' => true, 'forward' => true));
$request = $this->getRequestByPathInfo($pathInfo);
$this->urlAliasService->expects($this->once())->method('lookup')->with($pathInfo)->will($this->returnValue($urlAlias));
$this->urlALiasGenerator->expects($this->once())->method('loadLocation')->with($destinationId)->will($this->returnValue($destinationLocation));
$this->urlALiasGenerator->expects($this->once())->method('generate')->with($destinationLocation)->will($this->returnValue($newPathInfo));
$this->urlALiasGenerator->expects($this->once())->method('loadLocation')->will($this->returnValue($destinationLocation));
$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->assertSame($newPathInfo, $request->attributes->get('semanticPathinfo'));
$this->assertTrue($request->attributes->get('needsRedirect'));
$this->assertFalse($request->attributes->get('prependSiteaccessOnRedirect'));
}