/** * @dataProvider bundlesProvider */ public function testProcess(array $bundles, $expectedSet) { $this->container->expects($this->once())->method('getParameter')->with('kernel.bundles')->will($this->returnValue($bundles)); if ($expectedSet) { $taggedServices = array('some.service.id' => 'some arguments'); $this->container->expects($this->once())->method('findTaggedServiceIds')->with(FormProvider::TAG_NAME)->will($this->returnValue($taggedServices)); $definitionMock = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Definition')->disableOriginalConstructor()->getMock(); $this->container->expects($this->exactly(count($taggedServices)))->method('getDefinition')->will($this->returnValue($definitionMock)); $definitionMock->expects($this->exactly(count($taggedServices)))->method('replaceArgument')->with($this->equalTo(0)); } $this->compiler->process($this->container); }
public function testProcess() { $bundle = new TestBundle(); $bundles = array($bundle->getName() => get_class($bundle)); CumulativeResourceManager::getInstance()->clear()->setBundles($bundles); $this->container->expects($this->once())->method('getExtensions')->will($this->returnValue(['test_bundle' => null])); $this->container->expects($this->once())->method('getExtensionConfig')->with('test_bundle')->will($this->returnValue([['settings' => [SettingsBuilder::RESOLVED_KEY => true, 'some_field' => ['value' => 'some_val', 'scope' => 'app'], 'some_another_field' => ['value' => 'some_another_val', 'scope' => 'app']]]])); $bagServiceDef = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Definition')->disableOriginalConstructor()->getMock(); $providerServiceDef = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\Definition')->disableOriginalConstructor()->getMock(); $this->container->expects($this->once())->method('findTaggedServiceIds')->with(SystemConfigurationPass::CONFIG_PROVIDER_TAG_NAME)->will($this->returnValue(['provider_service' => [['scope' => 'app']]])); $this->container->expects($this->exactly(2))->method('getDefinition')->will($this->returnValueMap([[SystemConfigurationPass::CONFIG_DEFINITION_BAG_SERVICE, $bagServiceDef], ['provider_service', $providerServiceDef]])); $bagServiceDef->expects($this->once())->method('replaceArgument')->with($this->equalTo(0), $this->isType('array')); $providerServiceDef->expects($this->once())->method('replaceArgument')->with($this->equalTo(0), $this->isType('array')); $this->compiler->process($this->container); }