| @@ 975-998 (lines=24) @@ | ||
| 972 | * @param string $methodName |
|
| 973 | * @param array $params |
|
| 974 | */ |
|
| 975 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 976 | { |
|
| 977 | $calls = $definition->getMethodCalls(); |
|
| 978 | $called = false; |
|
| 979 | foreach ($calls as $call) { |
|
| 980 | if ($call[0] !== $methodName) { |
|
| 981 | continue; |
|
| 982 | } |
|
| 983 | ||
| 984 | if ($called) { |
|
| 985 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 986 | } else { |
|
| 987 | $called = true; |
|
| 988 | if ($params !== null) { |
|
| 989 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 990 | } |
|
| 991 | } |
|
| 992 | } |
|
| 993 | if ($called) { |
|
| 994 | return; |
|
| 995 | } |
|
| 996 | ||
| 997 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 998 | } |
|
| 999 | ||
| 1000 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1001 | { |
|
| @@ 824-847 (lines=24) @@ | ||
| 821 | * @param string $methodName |
|
| 822 | * @param array|null $params |
|
| 823 | */ |
|
| 824 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 825 | { |
|
| 826 | $calls = $definition->getMethodCalls(); |
|
| 827 | $called = false; |
|
| 828 | foreach ($calls as $call) { |
|
| 829 | if ($call[0] !== $methodName) { |
|
| 830 | continue; |
|
| 831 | } |
|
| 832 | ||
| 833 | if ($called) { |
|
| 834 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 835 | } else { |
|
| 836 | $called = true; |
|
| 837 | if ($params !== null) { |
|
| 838 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 839 | } |
|
| 840 | } |
|
| 841 | } |
|
| 842 | if ($called) { |
|
| 843 | return; |
|
| 844 | } |
|
| 845 | ||
| 846 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 847 | } |
|
| 848 | ||
| 849 | private function compileContainer(ContainerBuilder $container) |
|
| 850 | { |
|