| @@ 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 |     { | |
| @@ 801-824 (lines=24) @@ | ||
| 798 | * @param string $methodName | |
| 799 | * @param array|null $params | |
| 800 | */ | |
| 801 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) | |
| 802 |     { | |
| 803 | $calls = $definition->getMethodCalls(); | |
| 804 | $called = false; | |
| 805 |         foreach ($calls as $call) { | |
| 806 |             if ($call[0] !== $methodName) { | |
| 807 | continue; | |
| 808 | } | |
| 809 | ||
| 810 |             if ($called) { | |
| 811 |                 $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); | |
| 812 |             } else { | |
| 813 | $called = true; | |
| 814 |                 if ($params !== null) { | |
| 815 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); | |
| 816 | } | |
| 817 | } | |
| 818 | } | |
| 819 |         if ($called) { | |
| 820 | return; | |
| 821 | } | |
| 822 | ||
| 823 |         $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); | |
| 824 | } | |
| 825 | ||
| 826 | private function compileContainer(ContainerBuilder $container) | |
| 827 |     { | |