eZ\Bundle\EzPublishCoreBundle\Fragment\DecoratedFragmentRenderer::setSiteAccess PHP Method

setSiteAccess() public method

public setSiteAccess ( SiteAccess $siteAccess = null )
$siteAccess eZ\Publish\Core\MVC\Symfony\SiteAccess
    public function setSiteAccess(SiteAccess $siteAccess = null)
    {
        $this->siteAccess = $siteAccess;
    }

Usage Example

 public function testSetFragmentPath()
 {
     $matcher = $this->getMock('eZ\\Publish\\Core\\MVC\\Symfony\\SiteAccess\\URILexer');
     $siteAccess = new SiteAccess('test', 'test', $matcher);
     $matcher->expects($this->once())->method('analyseLink')->with('/foo')->will($this->returnValue('/bar/foo'));
     $innerRenderer = $this->getMock('Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer');
     $innerRenderer->expects($this->once())->method('setFragmentPath')->with('/bar/foo');
     $renderer = new DecoratedFragmentRenderer($innerRenderer);
     $renderer->setSiteAccess($siteAccess);
     $renderer->setFragmentPath('/foo');
 }