| @@ 545-564 (lines=20) @@ | ||
| 542 | * @param string $methodName |
|
| 543 | * @param array|null $params |
|
| 544 | */ |
|
| 545 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 546 | { |
|
| 547 | $calls = $definition->getMethodCalls(); |
|
| 548 | $called = false; |
|
| 549 | foreach ($calls as $call) { |
|
| 550 | if ($call[0] === $methodName) { |
|
| 551 | if ($called) { |
|
| 552 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
| 553 | } else { |
|
| 554 | $called = true; |
|
| 555 | if ($params !== null) { |
|
| 556 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
| 557 | } |
|
| 558 | } |
|
| 559 | } |
|
| 560 | } |
|
| 561 | if (!$called) { |
|
| 562 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
| 563 | } |
|
| 564 | } |
|
| 565 | ||
| 566 | private function compileContainer(ContainerBuilder $container) |
|
| 567 | { |
|
| @@ 888-907 (lines=20) @@ | ||
| 885 | * @param string $methodName |
|
| 886 | * @param array $params |
|
| 887 | */ |
|
| 888 | private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null) |
|
| 889 | { |
|
| 890 | $calls = $definition->getMethodCalls(); |
|
| 891 | $called = false; |
|
| 892 | foreach ($calls as $call) { |
|
| 893 | if ($call[0] == $methodName) { |
|
| 894 | if ($called) { |
|
| 895 | $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though."); |
|
| 896 | } else { |
|
| 897 | $called = true; |
|
| 898 | if ($params !== null) { |
|
| 899 | $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters."); |
|
| 900 | } |
|
| 901 | } |
|
| 902 | } |
|
| 903 | } |
|
| 904 | if (!$called) { |
|
| 905 | $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though."); |
|
| 906 | } |
|
| 907 | } |
|
| 908 | ||
| 909 | private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1) |
|
| 910 | { |
|