public function testShouldInitializeDependencies()
 {
     $dependency = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $object = $this->getMock('Oro\\Component\\Layout\\Tests\\Unit\\Extension\\Theme\\Stubs\\LayoutUpdateWithDependency');
     $object->expects($this->once())->method('setContainer')->with($this->identicalTo($dependency));
     $this->container->set('dependency_service_id', $dependency);
     $this->initializer->addKnownDependency('\\Symfony\\Component\\DependencyInjection\\ContainerAwareInterface', 'setContainer', 'dependency_service_id');
     $this->initializer->initialize($object);
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 protected function loadLayoutUpdates(ContextInterface $context)
 {
     $updates = [];
     if ($context->getOr('theme')) {
         $iterator = new ResourceIterator($this->findApplicableResources($context));
         foreach ($iterator as $file) {
             $update = $this->loader->load($file);
             if ($update) {
                 $this->dependencyInitializer->initialize($update);
                 $el = $update instanceof ElementDependentLayoutUpdateInterface ? $update->getElement() : 'root';
                 $updates[$el][] = $update;
             }
         }
     }
     return $updates;
 }
 public function testShouldPassDependenciesToUpdateInstance()
 {
     $themeName = 'oro-gold';
     $update = $this->getMock('Oro\\Component\\Layout\\LayoutUpdateInterface');
     $this->setUpResourcePathProvider($themeName);
     $callbackBuilder = $this->getCallbackBuilder();
     $this->yamlDriver->expects($this->any())->method('supports')->willReturnCallback($callbackBuilder('yml'));
     $this->yamlDriver->expects($this->once())->method('load')->willReturn($update);
     $this->dependencyInitializer->expects($this->once())->method('initialize')->with($this->identicalTo($update));
     $this->extension->getLayoutUpdates($this->getLayoutItem('root', $themeName));
 }