@@ 1048-1071 (lines=24) @@ | ||
1045 | * @param string $methodName |
|
1046 | * @param array $params |
|
1047 | */ |
|
1048 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
1049 | { |
|
1050 | $calls = $definition->getMethodCalls(); |
|
1051 | $called = false; |
|
1052 | foreach ($calls as $call) { |
|
1053 | if ($call[0] !== $methodName) { |
|
1054 | continue; |
|
1055 | } |
|
1056 | ||
1057 | if ($called) { |
|
1058 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
1059 | } else { |
|
1060 | $called = true; |
|
1061 | if ($params !== null) { |
|
1062 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
1063 | } |
|
1064 | } |
|
1065 | } |
|
1066 | if ($called) { |
|
1067 | return; |
|
1068 | } |
|
1069 | ||
1070 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
1071 | } |
|
1072 | ||
1073 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
1074 | { |
@@ 805-828 (lines=24) @@ | ||
802 | * @param string $methodName |
|
803 | * @param array|null $params |
|
804 | */ |
|
805 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
806 | { |
|
807 | $calls = $definition->getMethodCalls(); |
|
808 | $called = false; |
|
809 | foreach ($calls as $call) { |
|
810 | if ($call[0] !== $methodName) { |
|
811 | continue; |
|
812 | } |
|
813 | ||
814 | if ($called) { |
|
815 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
816 | } else { |
|
817 | $called = true; |
|
818 | if ($params !== null) { |
|
819 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
820 | } |
|
821 | } |
|
822 | } |
|
823 | if ($called) { |
|
824 | return; |
|
825 | } |
|
826 | ||
827 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
828 | } |
|
829 | ||
830 | private function compileContainer(ContainerBuilder $container) |
|
831 | { |