@@ 975-998 (lines=24) @@ | ||
972 | * @param string $methodName |
|
973 | * @param array $params |
|
974 | */ |
|
975 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
976 | { |
|
977 | $calls = $definition->getMethodCalls(); |
|
978 | $called = false; |
|
979 | foreach ($calls as $call) { |
|
980 | if ($call[0] !== $methodName) { |
|
981 | continue; |
|
982 | } |
|
983 | ||
984 | if ($called) { |
|
985 | $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though."); |
|
986 | } else { |
|
987 | $called = true; |
|
988 | if ($params !== null) { |
|
989 | $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters."); |
|
990 | } |
|
991 | } |
|
992 | } |
|
993 | if ($called) { |
|
994 | return; |
|
995 | } |
|
996 | ||
997 | $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though."); |
|
998 | } |
|
999 | ||
1000 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1) |
|
1001 | { |
@@ 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 | { |