public function testSetSiteAccess() { $matcherServiceIdentifier = 'my.matcher.service'; $resolverMock = $this->getMock('eZ\\Publish\\Core\\MVC\\ConfigResolverInterface'); $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $siteAccessName = 'siteaccess_name'; $updatedMatchConfig = array('full' => array('matchRule2' => array('template' => 'my_other_template.html.twig', 'match' => array('foo' => array('bar'))))); $resolverMock->expects($this->atLeastOnce())->method('getParameter')->will($this->returnValueMap(array(array('location_view', null, null, array('full' => array('matchRule' => array('template' => 'my_template.html.twig', 'match' => array($matcherServiceIdentifier => 'someValue'))))), array('location_view', 'ezsettings', $siteAccessName, $updatedMatchConfig)))); $matcherFactory = new LocationMatcherFactory($resolverMock, $this->getMock('eZ\\Publish\\API\\Repository\\Repository')); $matcherFactory->setContainer($container); $matcherFactory->setSiteAccess(new SiteAccess($siteAccessName)); $refObj = new \ReflectionObject($matcherFactory); $refProp = $refObj->getProperty('matchConfig'); $refProp->setAccessible(true); $this->assertSame($updatedMatchConfig, $refProp->getValue($matcherFactory)); }