| @@ 1221-1247 (lines=27) @@ | ||
| 1218 | /** |
|
| 1219 | * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. |
|
| 1220 | */ |
|
| 1221 | private function assertDICDefinitionMethodCallOnce( |
|
| 1222 | Definition $definition, |
|
| 1223 | string $methodName, |
|
| 1224 | array $params = null |
|
| 1225 | ) : void { |
|
| 1226 | $calls = $definition->getMethodCalls(); |
|
| 1227 | $called = false; |
|
| 1228 | foreach ($calls as $call) { |
|
| 1229 | if ($call[0] !== $methodName) { |
|
| 1230 | continue; |
|
| 1231 | } |
|
| 1232 | ||
| 1233 | if ($called) { |
|
| 1234 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1235 | } else { |
|
| 1236 | $called = true; |
|
| 1237 | if ($params !== null) { |
|
| 1238 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1239 | } |
|
| 1240 | } |
|
| 1241 | } |
|
| 1242 | if ($called) { |
|
| 1243 | return; |
|
| 1244 | } |
|
| 1245 | ||
| 1246 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1247 | } |
|
| 1248 | ||
| 1249 | private function assertDICDefinitionMethodCallCount( |
|
| 1250 | Definition $definition, |
|
| @@ 938-961 (lines=24) @@ | ||
| 935 | /** |
|
| 936 | * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. |
|
| 937 | */ |
|
| 938 | private function assertDICDefinitionMethodCallOnce(Definition $definition, string $methodName, array $params = null) : void |
|
| 939 | { |
|
| 940 | $calls = $definition->getMethodCalls(); |
|
| 941 | $called = false; |
|
| 942 | foreach ($calls as $call) { |
|
| 943 | if ($call[0] !== $methodName) { |
|
| 944 | continue; |
|
| 945 | } |
|
| 946 | ||
| 947 | if ($called) { |
|
| 948 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 949 | } else { |
|
| 950 | $called = true; |
|
| 951 | if ($params !== null) { |
|
| 952 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 953 | } |
|
| 954 | } |
|
| 955 | } |
|
| 956 | if ($called) { |
|
| 957 | return; |
|
| 958 | } |
|
| 959 | ||
| 960 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 961 | } |
|
| 962 | ||
| 963 | private function compileContainer(ContainerBuilder $container) : void |
|
| 964 | { |
|