eZ\Bundle\EzPublishCoreBundle\Tests\Routing\UrlAliasRouterTest::testMatchRequestWithRootLocationAndExclusion PHP Метод

testMatchRequestWithRootLocationAndExclusion() публичный Метод

    public function testMatchRequestWithRootLocationAndExclusion()
    {
        $this->resetConfigResolver();
        $this->configResolver->expects($this->any())->method('getParameter')->will($this->returnValueMap(array(array('url_alias_router', null, null, true), array('content.tree_root.location_id', null, null, 123), array('content.tree_root.excluded_uri_prefixes', null, null, array('/shared/content')))));
        $this->router->setRootLocationId(123);
        $pathInfo = '/shared/content/foo-bar';
        $destinationId = 789;
        $this->urlALiasGenerator->expects($this->any())->method('isUriPrefixExcluded')->with($pathInfo)->will($this->returnValue(true));
        $urlAlias = new URLAlias(array('path' => $pathInfo, 'type' => UrlAlias::LOCATION, 'destination' => $destinationId, 'isHistory' => false));
        $request = $this->getRequestByPathInfo($pathInfo);
        $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->assertSame($destinationId, $request->attributes->get('locationId'));
    }