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