onConfigScopeChange() public method

public onConfigScopeChange ( ScopeChangeEvent $event )
$event eZ\Publish\Core\MVC\Symfony\Event\ScopeChangeEvent
 public function testOnConfigScopeChange()
 {
     $siteAccess = new SiteAccess('test');
     $event = new ScopeChangeEvent($siteAccess);
     $resettableServices = array('foo', 'bar.baz');
     $dynamicSettingsServiceIds = array('something', 'something_else');
     $this->container->expects($this->at(0))->method('set')->with('foo', null);
     $this->container->expects($this->at(1))->method('set')->with('bar.baz', null);
     $fakeService1 = new \stdClass();
     $this->container->expects($this->at(2))->method('set')->with('something', null);
     $this->container->expects($this->at(3))->method('get')->with('something')->will($this->returnValue($fakeService1));
     $this->container->expects($this->at(4))->method('set')->with('something', $fakeService1);
     $fakeService2 = new \stdClass();
     $this->container->expects($this->at(5))->method('set')->with('something_else', null);
     $this->container->expects($this->at(6))->method('get')->with('something_else')->will($this->returnValue($fakeService2));
     $this->container->expects($this->at(7))->method('set')->with('something_else', $fakeService2);
     $listener = new DynamicSettingsListener($resettableServices, $dynamicSettingsServiceIds);
     $listener->setContainer($this->container);
     $listener->onConfigScopeChange($event);
     $this->assertSame($siteAccess, $event->getSiteAccess());
 }
 public function testOnConfigScopeChange()
 {
     $siteAccess = new SiteAccess('test');
     $event = new ScopeChangeEvent($siteAccess);
     $resettableServices = array('foo', 'bar.baz');
     $updateableServices = array('some_service' => array(array('someMethod', 'some_expression')), 'another_service' => array(array('someMethod', 'another_expression')));
     $this->container->expects($this->at(0))->method('initialized')->willReturn(true);
     $this->container->expects($this->at(1))->method('set')->with('foo', null);
     $this->container->expects($this->at(2))->method('initialized')->willReturn(true);
     $this->container->expects($this->at(3))->method('set')->with('bar.baz', null);
     $updateableService1 = $this->getMock('\\eZ\\Bundle\\EzPublishCoreBundle\\Tests\\EventListener\\Stubs\\FooServiceInterface');
     $dynamicSetting1 = 'foo';
     $this->container->expects($this->at(4))->method('initialized')->willReturn(true);
     $this->container->expects($this->at(5))->method('get')->with('some_service')->willReturn($updateableService1);
     $updateableService1->expects($this->once())->method('someMethod')->with($dynamicSetting1);
     $updateableService2 = $this->getMock('\\eZ\\Bundle\\EzPublishCoreBundle\\Tests\\EventListener\\Stubs\\FooServiceInterface');
     $dynamicSetting2 = array('foo' => 'bar');
     $this->container->expects($this->at(6))->method('initialized')->willReturn(true);
     $this->container->expects($this->at(7))->method('get')->with('another_service')->willReturn($updateableService2);
     $updateableService2->expects($this->once())->method('someMethod')->with($dynamicSetting2);
     $this->expressionLanguage->expects($this->exactly(count($updateableServices)))->method('evaluate')->willReturnMap(array(array('some_expression', array('container' => $this->container), $dynamicSetting1), array('another_expression', array('container' => $this->container), $dynamicSetting2)));
     $listener = new DynamicSettingsListener($resettableServices, $updateableServices, $this->expressionLanguage);
     $listener->setContainer($this->container);
     $listener->onConfigScopeChange($event);
     $this->assertSame($siteAccess, $event->getSiteAccess());
 }