| @@ 977-1000 (lines=24) @@ | ||
| 974 | * @param string $methodName | |
| 975 | * @param array $params | |
| 976 | */ | |
| 977 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) | |
| 978 |     { | |
| 979 | $calls = $definition->getMethodCalls(); | |
| 980 | $called = false; | |
| 981 |         foreach ($calls as $call) { | |
| 982 |             if ($call[0] !== $methodName) { | |
| 983 | continue; | |
| 984 | } | |
| 985 | ||
| 986 |             if ($called) { | |
| 987 |                 $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); | |
| 988 |             } else { | |
| 989 | $called = true; | |
| 990 |                 if ($params !== null) { | |
| 991 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); | |
| 992 | } | |
| 993 | } | |
| 994 | } | |
| 995 |         if ($called) { | |
| 996 | return; | |
| 997 | } | |
| 998 | ||
| 999 |         $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); | |
| 1000 | } | |
| 1001 | ||
| 1002 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) | |
| 1003 |     { | |
| @@ 771-794 (lines=24) @@ | ||
| 768 | * @param string $methodName | |
| 769 | * @param array|null $params | |
| 770 | */ | |
| 771 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) | |
| 772 |     { | |
| 773 | $calls = $definition->getMethodCalls(); | |
| 774 | $called = false; | |
| 775 |         foreach ($calls as $call) { | |
| 776 |             if ($call[0] !== $methodName) { | |
| 777 | continue; | |
| 778 | } | |
| 779 | ||
| 780 |             if ($called) { | |
| 781 |                 $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); | |
| 782 |             } else { | |
| 783 | $called = true; | |
| 784 |                 if ($params !== null) { | |
| 785 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); | |
| 786 | } | |
| 787 | } | |
| 788 | } | |
| 789 |         if ($called) { | |
| 790 | return; | |
| 791 | } | |
| 792 | ||
| 793 |         $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); | |
| 794 | } | |
| 795 | ||
| 796 | private function compileContainer(ContainerBuilder $container) | |
| 797 |     { | |