| @@ 1039-1058 (lines=20) @@ | ||
| 1036 | * @param string $methodName |
|
| 1037 | * @param array $params |
|
| 1038 | */ |
|
| 1039 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1040 | { |
|
| 1041 | $calls = $definition->getMethodCalls(); |
|
| 1042 | $called = false; |
|
| 1043 | foreach ($calls as $call) { |
|
| 1044 | if ($call[0] === $methodName) { |
|
| 1045 | if ($called) { |
|
| 1046 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 1047 | } else { |
|
| 1048 | $called = true; |
|
| 1049 | if ($params !== null) { |
|
| 1050 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 1051 | } |
|
| 1052 | } |
|
| 1053 | } |
|
| 1054 | } |
|
| 1055 | if (! $called) { |
|
| 1056 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 1057 | } |
|
| 1058 | } |
|
| 1059 | ||
| 1060 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
| 1061 | { |
|
| @@ 772-791 (lines=20) @@ | ||
| 769 | * @param string $methodName |
|
| 770 | * @param array|null $params |
|
| 771 | */ |
|
| 772 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 773 | { |
|
| 774 | $calls = $definition->getMethodCalls(); |
|
| 775 | $called = false; |
|
| 776 | foreach ($calls as $call) { |
|
| 777 | if ($call[0] === $methodName) { |
|
| 778 | if ($called) { |
|
| 779 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
| 780 | } else { |
|
| 781 | $called = true; |
|
| 782 | if ($params !== null) { |
|
| 783 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
| 784 | } |
|
| 785 | } |
|
| 786 | } |
|
| 787 | } |
|
| 788 | if (! $called) { |
|
| 789 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
| 790 | } |
|
| 791 | } |
|
| 792 | ||
| 793 | private function compileContainer(ContainerBuilder $container) |
|
| 794 | { |
|