@@ 568-587 (lines=20) @@ | ||
565 | * @param string $methodName |
|
566 | * @param array|null $params |
|
567 | */ |
|
568 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
569 | { |
|
570 | $calls = $definition->getMethodCalls(); |
|
571 | $called = false; |
|
572 | foreach ($calls as $call) { |
|
573 | if ($call[0] === $methodName) { |
|
574 | if ($called) { |
|
575 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
576 | } else { |
|
577 | $called = true; |
|
578 | if ($params !== null) { |
|
579 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
580 | } |
|
581 | } |
|
582 | } |
|
583 | } |
|
584 | if (!$called) { |
|
585 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
586 | } |
|
587 | } |
|
588 | ||
589 | private function compileContainer(ContainerBuilder $container) |
|
590 | { |
@@ 970-989 (lines=20) @@ | ||
967 | * @param string $methodName |
|
968 | * @param array $params |
|
969 | */ |
|
970 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
971 | { |
|
972 | $calls = $definition->getMethodCalls(); |
|
973 | $called = false; |
|
974 | foreach ($calls as $call) { |
|
975 | if ($call[0] == $methodName) { |
|
976 | if ($called) { |
|
977 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
978 | } else { |
|
979 | $called = true; |
|
980 | if ($params !== null) { |
|
981 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
982 | } |
|
983 | } |
|
984 | } |
|
985 | } |
|
986 | if (!$called) { |
|
987 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
988 | } |
|
989 | } |
|
990 | ||
991 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1) |
|
992 | { |