Code Duplication    Length = 15-21 lines in 2 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 847-861 (lines=15) @@
844
        $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match.");
845
    }
846
847
    private function assertDICDefinitionMethodCallAt(int $pos, Definition $definition, string $methodName, array $params = null) : void
848
    {
849
        $calls = $definition->getMethodCalls();
850
        if (! isset($calls[$pos][0])) {
851
            return;
852
        }
853
854
        $this->assertEquals($methodName, $calls[$pos][0], "Method '" . $methodName . "' is expected to be called at position " . $pos . '.');
855
856
        if ($params === null) {
857
            return;
858
        }
859
860
        $this->assertEquals($params, $calls[$pos][1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
861
    }
862
863
    /**
864
     * Assertion for the DI Container, check if the given definition contains a method call with the given parameters.

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1087-1107 (lines=21) @@
1084
        $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match.");
1085
    }
1086
1087
    private function assertDICDefinitionMethodCallAt(
1088
        int $pos,
1089
        Definition $definition,
1090
        string $methodName,
1091
        array $params = null
1092
    ) : void {
1093
        $calls = $definition->getMethodCalls();
1094
        if (! isset($calls[$pos][0])) {
1095
            $this->fail(sprintf('Method call at position %s not found!', $pos));
1096
1097
            return;
1098
        }
1099
1100
        $this->assertEquals($methodName, $calls[$pos][0], "Method '" . $methodName . "' is expected to be called at position " . $pos . '.');
1101
1102
        if ($params === null) {
1103
            return;
1104
        }
1105
1106
        $this->assertEquals($params, $calls[$pos][1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
1107
    }
1108
1109
    /**
1110
     * Assertion for the DI Container, check if the given definition contains a method call with the given parameters.