Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1095-1118 (lines=24) @@
1092
     * @param string $methodName
1093
     * @param array  $params
1094
     */
1095
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
1096
    {
1097
        $calls  = $definition->getMethodCalls();
1098
        $called = false;
1099
        foreach ($calls as $call) {
1100
            if ($call[0] !== $methodName) {
1101
                continue;
1102
            }
1103
1104
            if ($called) {
1105
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
1106
            } else {
1107
                $called = true;
1108
                if ($params !== null) {
1109
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
1110
                }
1111
            }
1112
        }
1113
        if ($called) {
1114
            return;
1115
        }
1116
1117
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
1118
    }
1119
1120
    private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1)
1121
    {

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 914-937 (lines=24) @@
911
     * @param string     $methodName
912
     * @param array|null $params
913
     */
914
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
915
    {
916
        $calls  = $definition->getMethodCalls();
917
        $called = false;
918
        foreach ($calls as $call) {
919
            if ($call[0] !== $methodName) {
920
                continue;
921
            }
922
923
            if ($called) {
924
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
925
            } else {
926
                $called = true;
927
                if ($params !== null) {
928
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
929
                }
930
            }
931
        }
932
        if ($called) {
933
            return;
934
        }
935
936
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
937
    }
938
939
    private function compileContainer(ContainerBuilder $container)
940
    {