@@ 783-802 (lines=20) @@ | ||
780 | * @param string $methodName |
|
781 | * @param array|null $params |
|
782 | */ |
|
783 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
784 | { |
|
785 | $calls = $definition->getMethodCalls(); |
|
786 | $called = false; |
|
787 | foreach ($calls as $call) { |
|
788 | if ($call[0] === $methodName) { |
|
789 | if ($called) { |
|
790 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
791 | } else { |
|
792 | $called = true; |
|
793 | if ($params !== null) { |
|
794 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
795 | } |
|
796 | } |
|
797 | } |
|
798 | } |
|
799 | if (!$called) { |
|
800 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
801 | } |
|
802 | } |
|
803 | ||
804 | private function compileContainer(ContainerBuilder $container) |
|
805 | { |
@@ 1068-1087 (lines=20) @@ | ||
1065 | * @param string $methodName |
|
1066 | * @param array $params |
|
1067 | */ |
|
1068 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
1069 | { |
|
1070 | $calls = $definition->getMethodCalls(); |
|
1071 | $called = false; |
|
1072 | foreach ($calls as $call) { |
|
1073 | if ($call[0] == $methodName) { |
|
1074 | if ($called) { |
|
1075 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
1076 | } else { |
|
1077 | $called = true; |
|
1078 | if ($params !== null) { |
|
1079 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
1080 | } |
|
1081 | } |
|
1082 | } |
|
1083 | } |
|
1084 | if (!$called) { |
|
1085 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
1086 | } |
|
1087 | } |
|
1088 | ||
1089 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1) |
|
1090 | { |