/** * setup mock and test object */ protected function setUp() { $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $this->resolver = new SystemAwareResolver(); $this->resolver->setContainer($container); $service1 = new TestService(); $service2 = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface'); $service2->expects($this->any())->method('getResource')->will($this->returnValue(array('service', 2))); $container->expects($this->any())->method('getParameter')->will($this->returnValueMap(array(array('test.param1', 'val1'), array('test.other_param', array('val', 2)), array('test.class', 'Oro\\Component\\Config\\Tests\\Unit\\Resolver\\SystemAwareResolverTest')))); $container->expects($this->any())->method('get')->will($this->returnValueMap(array(array('test.service', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, new \stdClass()), array('test.service1', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service1), array('test.other_service', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service2)))); }
/** * @dataProvider configProvider * * @param array $config * @param string $integrationType * @param array $expectedFields * @param bool $resolvedValue */ public function testGetFormSettings($config, $integrationType, $expectedFields, $resolvedValue) { $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface'); $resolver = new SystemAwareResolver(); $resolver->setContainer($container); $service = new TestService($resolvedValue); $container->expects($this->any())->method('get')->will($this->returnValueMap([['test.client', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service]])); $provider = new SettingsProvider($config, $resolver); $result = $provider->getFormSettings('synchronization_settings', $integrationType); $this->assertEquals($expectedFields, array_keys($result)); }