| @@ 1012-1031 (lines=20) @@ | ||
| 1009 | * @param string $methodName |
|
| 1010 | * @param array $params |
|
| 1011 | */ |
|
| 1012 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 1013 | { |
|
| 1014 | $calls = $definition->getMethodCalls(); |
|
| 1015 | $called = false; |
|
| 1016 | foreach ($calls as $call) { |
|
| 1017 | if ($call[0] == $methodName) { |
|
| 1018 | if ($called) { |
|
| 1019 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
| 1020 | } else { |
|
| 1021 | $called = true; |
|
| 1022 | if ($params !== null) { |
|
| 1023 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
| 1024 | } |
|
| 1025 | } |
|
| 1026 | } |
|
| 1027 | } |
|
| 1028 | if (!$called) { |
|
| 1029 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
| 1030 | } |
|
| 1031 | } |
|
| 1032 | ||
| 1033 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1) |
|
| 1034 | { |
|
| @@ 779-798 (lines=20) @@ | ||
| 776 | * @param string $methodName |
|
| 777 | * @param array|null $params |
|
| 778 | */ |
|
| 779 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 780 | { |
|
| 781 | $calls = $definition->getMethodCalls(); |
|
| 782 | $called = false; |
|
| 783 | foreach ($calls as $call) { |
|
| 784 | if ($call[0] === $methodName) { |
|
| 785 | if ($called) { |
|
| 786 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
| 787 | } else { |
|
| 788 | $called = true; |
|
| 789 | if ($params !== null) { |
|
| 790 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
| 791 | } |
|
| 792 | } |
|
| 793 | } |
|
| 794 | } |
|
| 795 | if (!$called) { |
|
| 796 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
| 797 | } |
|
| 798 | } |
|
| 799 | ||
| 800 | private function compileContainer(ContainerBuilder $container) |
|
| 801 | { |
|