public function testProcessWithAlias()
 {
     $definitionMock = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Definition')->disableOriginalConstructor()->getMock();
     $definitionMock->expects($this->at(0))->method('addMethodCall')->with($this->equalTo('addExtension'), $this->equalTo(array(new Reference('id'), 0)));
     $definitionMock->expects($this->at(1))->method('addMethodCall')->with($this->equalTo('addExtension'), $this->equalTo(array(new Reference('id'), 12)));
     $definitionMock->expects($this->at(2))->method('addMethodCall')->with($this->equalTo('addExtension'), $this->equalTo(array(new Reference('foo'), -4)));
     $containerBuilderMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $containerBuilderMock->expects($this->once())->method('hasDefinition')->will($this->returnValue(true));
     $containerBuilderMock->expects($this->once())->method('findTaggedServiceIds')->with($this->equalTo('knp_menu.factory_extension'))->will($this->returnValue(array('id' => array('tag1' => array(), 'tag2' => array('priority' => 12)), 'foo' => array('tag1' => array('priority' => -4)))));
     $containerBuilderMock->expects($this->once())->method('getDefinition')->with($this->equalTo('knp_menu.factory'))->will($this->returnValue($definitionMock));
     $menuPass = new AddExtensionsPass();
     $menuPass->process($containerBuilderMock);
 }
Esempio n. 2
0
 /**
  * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
  */
 public function testMissingAddExtension()
 {
     $definitionMock = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Definition')->disableOriginalConstructor()->getMock();
     $definitionMock->expects($this->at(0))->method('getClass')->will($this->returnValue('SimpleMenuFactory'));
     $parameterBagMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface');
     $parameterBagMock->expects($this->once())->method('resolveValue')->with('SimpleMenuFactory')->will($this->returnValue('SimpleMenuFactory'));
     $containerBuilderMock = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
     $containerBuilderMock->expects($this->once())->method('has')->will($this->returnValue(true));
     $containerBuilderMock->expects($this->once())->method('findTaggedServiceIds')->with($this->equalTo('knp_menu.factory_extension'))->will($this->returnValue(array('id' => array('tag1' => array(), 'tag2' => array('priority' => 12)), 'foo' => array('tag1' => array('priority' => -4)))));
     $containerBuilderMock->expects($this->once())->method('findDefinition')->with($this->equalTo('knp_menu.factory'))->will($this->returnValue($definitionMock));
     $containerBuilderMock->expects($this->once())->method('getParameterBag')->will($this->returnValue($parameterBagMock));
     $menuPass = new AddExtensionsPass();
     $menuPass->process($containerBuilderMock);
 }