| @@ 1044-1067 (lines=24) @@ | ||
| 1041 | * @param string $methodName |
|
| 1042 | * @param array $params |
|
| 1043 | */ |
|
| 1044 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1045 | { |
|
| 1046 | $calls = $definition->getMethodCalls(); |
|
| 1047 | $called = false; |
|
| 1048 | foreach ($calls as $call) { |
|
| 1049 | if ($call[0] !== $methodName) { |
|
| 1050 | continue; |
|
| 1051 | } |
|
| 1052 | ||
| 1053 | if ($called) { |
|
| 1054 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1055 | } else { |
|
| 1056 | $called = true; |
|
| 1057 | if ($params !== null) { |
|
| 1058 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1059 | } |
|
| 1060 | } |
|
| 1061 | } |
|
| 1062 | if ($called) { |
|
| 1063 | return; |
|
| 1064 | } |
|
| 1065 | ||
| 1066 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1067 | } |
|
| 1068 | ||
| 1069 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1070 | { |
|
| @@ 806-829 (lines=24) @@ | ||
| 803 | * @param string $methodName |
|
| 804 | * @param array|null $params |
|
| 805 | */ |
|
| 806 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 807 | { |
|
| 808 | $calls = $definition->getMethodCalls(); |
|
| 809 | $called = false; |
|
| 810 | foreach ($calls as $call) { |
|
| 811 | if ($call[0] !== $methodName) { |
|
| 812 | continue; |
|
| 813 | } |
|
| 814 | ||
| 815 | if ($called) { |
|
| 816 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 817 | } else { |
|
| 818 | $called = true; |
|
| 819 | if ($params !== null) { |
|
| 820 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 821 | } |
|
| 822 | } |
|
| 823 | } |
|
| 824 | if ($called) { |
|
| 825 | return; |
|
| 826 | } |
|
| 827 | ||
| 828 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 829 | } |
|
| 830 | ||
| 831 | private function compileContainer(ContainerBuilder $container) |
|
| 832 | { |
|