| @@ 1064-1087 (lines=24) @@ | ||
| 1061 | * @param string $methodName |
|
| 1062 | * @param array $params |
|
| 1063 | */ |
|
| 1064 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1065 | { |
|
| 1066 | $calls = $definition->getMethodCalls(); |
|
| 1067 | $called = false; |
|
| 1068 | foreach ($calls as $call) { |
|
| 1069 | if ($call[0] !== $methodName) { |
|
| 1070 | continue; |
|
| 1071 | } |
|
| 1072 | ||
| 1073 | if ($called) { |
|
| 1074 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1075 | } else { |
|
| 1076 | $called = true; |
|
| 1077 | if ($params !== null) { |
|
| 1078 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1079 | } |
|
| 1080 | } |
|
| 1081 | } |
|
| 1082 | if ($called) { |
|
| 1083 | return; |
|
| 1084 | } |
|
| 1085 | ||
| 1086 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1087 | } |
|
| 1088 | ||
| 1089 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1090 | { |
|
| @@ 854-877 (lines=24) @@ | ||
| 851 | * @param string $methodName |
|
| 852 | * @param array|null $params |
|
| 853 | */ |
|
| 854 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 855 | { |
|
| 856 | $calls = $definition->getMethodCalls(); |
|
| 857 | $called = false; |
|
| 858 | foreach ($calls as $call) { |
|
| 859 | if ($call[0] !== $methodName) { |
|
| 860 | continue; |
|
| 861 | } |
|
| 862 | ||
| 863 | if ($called) { |
|
| 864 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 865 | } else { |
|
| 866 | $called = true; |
|
| 867 | if ($params !== null) { |
|
| 868 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 869 | } |
|
| 870 | } |
|
| 871 | } |
|
| 872 | if ($called) { |
|
| 873 | return; |
|
| 874 | } |
|
| 875 | ||
| 876 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 877 | } |
|
| 878 | ||
| 879 | private function compileContainer(ContainerBuilder $container) |
|
| 880 | { |
|