| @@ 1028-1051 (lines=24) @@ | ||
| 1025 | * @param string $methodName |
|
| 1026 | * @param array $params |
|
| 1027 | */ |
|
| 1028 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1029 | { |
|
| 1030 | $calls = $definition->getMethodCalls(); |
|
| 1031 | $called = false; |
|
| 1032 | foreach ($calls as $call) { |
|
| 1033 | if ($call[0] !== $methodName) { |
|
| 1034 | continue; |
|
| 1035 | } |
|
| 1036 | ||
| 1037 | if ($called) { |
|
| 1038 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1039 | } else { |
|
| 1040 | $called = true; |
|
| 1041 | if ($params !== null) { |
|
| 1042 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1043 | } |
|
| 1044 | } |
|
| 1045 | } |
|
| 1046 | if ($called) { |
|
| 1047 | return; |
|
| 1048 | } |
|
| 1049 | ||
| 1050 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1051 | } |
|
| 1052 | ||
| 1053 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1054 | { |
|
| @@ 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 | { |
|