1 | <?php |
||
10 | class OroCRMMagentoExtensionTest extends \PHPUnit_Framework_TestCase |
||
11 | { |
||
12 | public function testConfigPassedToConnectors() |
||
13 | { |
||
14 | $config = [ |
||
15 | 'sync_settings' => [ |
||
16 | 'mistiming_assumption_interval' => '10 minutes', |
||
17 | 'initial_import_step_interval' => '1 day', |
||
18 | 'region_sync_interval' => '1 day', |
||
19 | 'skip_ssl_verification' => false |
||
20 | ] |
||
21 | ]; |
||
22 | |||
23 | $container = new ContainerBuilder(); |
||
24 | $extension = new OroCRMMagentoExtension(); |
||
25 | |||
26 | $extension->load(['oro_crm_magento' => $config], $container); |
||
27 | |||
28 | $tagged = $container->findTaggedServiceIds('orocrm_magento.bundle_config.aware'); |
||
29 | |||
30 | $missedConfigDefinitions = []; |
||
31 | foreach (array_keys($tagged) as $serviceId) { |
||
32 | $definition = $container->getDefinition($serviceId); |
||
33 | |||
34 | $definition->getArguments(); |
||
|
|||
35 | $configArguments = array_filter( |
||
36 | $definition->getArguments(), |
||
37 | function ($arg) use ($config) { |
||
38 | return $arg === $config; |
||
39 | } |
||
40 | ); |
||
41 | |||
42 | if (!$configArguments) { |
||
43 | $missedConfigDefinitions[] = $serviceId; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | $this->assertEquals([], $missedConfigDefinitions, 'Should contain config array'); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
||
52 | * @expectedExceptionMessage Strategy configuration contains unknown fields "unknown_field" |
||
53 | */ |
||
54 | public function testInvalidAccountDiscoveryConfiguration() |
||
77 | |||
78 | /** |
||
79 | * @dataProvider inheritanceConfigurationDataProvider |
||
80 | * |
||
81 | * @param array $config |
||
82 | * @param array $resultConfig |
||
83 | */ |
||
84 | public function testInheritanceConfiguration(array $config, array $resultConfig) |
||
115 | |||
116 | /** |
||
117 | * @return array |
||
118 | */ |
||
119 | public function inheritanceConfigurationDataProvider() |
||
166 | } |
||
167 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: