public function testProcess() { $d = new Definition(); $cb = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder'); $cb->expects($this->atLeastOnce())->method('hasDefinition')->with('liip_imagine.filter.manager')->will($this->returnValue(true)); $cb->expects($this->atLeastOnce())->method('getDefinition')->with('liip_imagine.filter.manager')->will($this->returnValue($d)); $cb->expects($this->atLeastOnce())->method('findTaggedServiceIds')->with('liip_imagine.filter.loader')->will($this->returnValue(array('a' => array(array('loader' => 'foo'))))); $pass = new FiltersCompilerPass(); $pass->process($cb); $this->assertCount(1, $d->getMethodCalls()); }
public function testProcess() { $managerDefinition = new Definition(); $loaderDefinition = new Definition(); $loaderDefinition->addTag('liip_imagine.filter.loader', array('loader' => 'foo')); $container = new ContainerBuilder(); $container->setDefinition('liip_imagine.filter.manager', $managerDefinition); $container->setDefinition('a.loader', $loaderDefinition); $pass = new FiltersCompilerPass(); //guard $this->assertCount(0, $managerDefinition->getMethodCalls()); $pass->process($container); $this->assertCount(1, $managerDefinition->getMethodCalls()); }