Code Duplication    Length = 20-20 lines in 2 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 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
    {

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1055-1074 (lines=20) @@
1052
     * @param string     $methodName
1053
     * @param array      $params
1054
     */
1055
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
1056
    {
1057
        $calls = $definition->getMethodCalls();
1058
        $called = false;
1059
        foreach ($calls as $call) {
1060
            if ($call[0] == $methodName) {
1061
                if ($called) {
1062
                    $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though.");
1063
                } else {
1064
                    $called = true;
1065
                    if ($params !== null) {
1066
                        $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
1067
                    }
1068
                }
1069
            }
1070
        }
1071
        if (!$called) {
1072
            $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though.");
1073
        }
1074
    }
1075
1076
    private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1)
1077
    {