| @@ 769-792 (lines=24) @@ | ||
| 766 | * @param string $methodName | |
| 767 | * @param array|null $params | |
| 768 | */ | |
| 769 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) | |
| 770 |     { | |
| 771 | $calls = $definition->getMethodCalls(); | |
| 772 | $called = false; | |
| 773 |         foreach ($calls as $call) { | |
| 774 |             if ($call[0] !== $methodName) { | |
| 775 | continue; | |
| 776 | } | |
| 777 | ||
| 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 |         if ($called) { | |
| 788 | return; | |
| 789 | } | |
| 790 | ||
| 791 |         $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); | |
| 792 | } | |
| 793 | ||
| 794 | private function compileContainer(ContainerBuilder $container) | |
| 795 |     { | |
| @@ 1028-1051 (lines=24) @@ | ||
| 1025 | * @param string $methodName | |
| 1026 | * @param array $params | |
| 1027 | */ | |
| 1028 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) | |
| 1029 |     { | |
| 1030 | $calls = $definition->getMethodCalls(); | |
| 1031 | $called = false; | |
| 1032 |         foreach ($calls as $call) { | |
| 1033 |             if ($call[0] !== $methodName) { | |
| 1034 | continue; | |
| 1035 | } | |
| 1036 | ||
| 1037 |             if ($called) { | |
| 1038 |                 $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); | |
| 1039 |             } else { | |
| 1040 | $called = true; | |
| 1041 |                 if ($params !== null) { | |
| 1042 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); | |
| 1043 | } | |
| 1044 | } | |
| 1045 | } | |
| 1046 |         if ($called) { | |
| 1047 | return; | |
| 1048 | } | |
| 1049 | ||
| 1050 |         $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); | |
| 1051 | } | |
| 1052 | ||
| 1053 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) | |
| 1054 |     { | |