| @@ 859-882 (lines=24) @@ | ||
| 856 | * @param string $methodName |
|
| 857 | * @param array|null $params |
|
| 858 | */ |
|
| 859 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 860 | { |
|
| 861 | $calls = $definition->getMethodCalls(); |
|
| 862 | $called = false; |
|
| 863 | foreach ($calls as $call) { |
|
| 864 | if ($call[0] !== $methodName) { |
|
| 865 | continue; |
|
| 866 | } |
|
| 867 | ||
| 868 | if ($called) { |
|
| 869 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 870 | } else { |
|
| 871 | $called = true; |
|
| 872 | if ($params !== null) { |
|
| 873 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 874 | } |
|
| 875 | } |
|
| 876 | } |
|
| 877 | if ($called) { |
|
| 878 | return; |
|
| 879 | } |
|
| 880 | ||
| 881 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 882 | } |
|
| 883 | ||
| 884 | private function compileContainer(ContainerBuilder $container) |
|
| 885 | { |
|
| @@ 1091-1114 (lines=24) @@ | ||
| 1088 | * @param string $methodName |
|
| 1089 | * @param array $params |
|
| 1090 | */ |
|
| 1091 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1092 | { |
|
| 1093 | $calls = $definition->getMethodCalls(); |
|
| 1094 | $called = false; |
|
| 1095 | foreach ($calls as $call) { |
|
| 1096 | if ($call[0] !== $methodName) { |
|
| 1097 | continue; |
|
| 1098 | } |
|
| 1099 | ||
| 1100 | if ($called) { |
|
| 1101 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1102 | } else { |
|
| 1103 | $called = true; |
|
| 1104 | if ($params !== null) { |
|
| 1105 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1106 | } |
|
| 1107 | } |
|
| 1108 | } |
|
| 1109 | if ($called) { |
|
| 1110 | return; |
|
| 1111 | } |
|
| 1112 | ||
| 1113 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1114 | } |
|
| 1115 | ||
| 1116 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1117 | { |
|