@@ 866-889 (lines=24) @@ | ||
863 | /** |
|
864 | * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. |
|
865 | */ |
|
866 | private function assertDICDefinitionMethodCallOnce(Definition $definition, string $methodName, array $params = null) : void |
|
867 | { |
|
868 | $calls = $definition->getMethodCalls(); |
|
869 | $called = false; |
|
870 | foreach ($calls as $call) { |
|
871 | if ($call[0] !== $methodName) { |
|
872 | continue; |
|
873 | } |
|
874 | ||
875 | if ($called) { |
|
876 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
877 | } else { |
|
878 | $called = true; |
|
879 | if ($params !== null) { |
|
880 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
881 | } |
|
882 | } |
|
883 | } |
|
884 | if ($called) { |
|
885 | return; |
|
886 | } |
|
887 | ||
888 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
889 | } |
|
890 | ||
891 | private function compileContainer(ContainerBuilder $container) : void |
|
892 | { |
@@ 1112-1138 (lines=27) @@ | ||
1109 | /** |
|
1110 | * Assertion for the DI Container, check if the given definition contains a method call with the given parameters. |
|
1111 | */ |
|
1112 | private function assertDICDefinitionMethodCallOnce( |
|
1113 | Definition $definition, |
|
1114 | string $methodName, |
|
1115 | array $params = null |
|
1116 | ) : void { |
|
1117 | $calls = $definition->getMethodCalls(); |
|
1118 | $called = false; |
|
1119 | foreach ($calls as $call) { |
|
1120 | if ($call[0] !== $methodName) { |
|
1121 | continue; |
|
1122 | } |
|
1123 | ||
1124 | if ($called) { |
|
1125 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
1126 | } else { |
|
1127 | $called = true; |
|
1128 | if ($params !== null) { |
|
1129 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
1130 | } |
|
1131 | } |
|
1132 | } |
|
1133 | if ($called) { |
|
1134 | return; |
|
1135 | } |
|
1136 | ||
1137 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
1138 | } |
|
1139 | ||
1140 | private function assertDICDefinitionMethodCallCount( |
|
1141 | Definition $definition, |