Code Duplication    Length = 15-21 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1196-1216 (lines=21) @@
1193
        $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match.");
1194
    }
1195
1196
    private function assertDICDefinitionMethodCallAt(
1197
        int $pos,
1198
        Definition $definition,
1199
        string $methodName,
1200
        array $params = null
1201
    ) : void {
1202
        $calls = $definition->getMethodCalls();
1203
        if (! isset($calls[$pos][0])) {
1204
            $this->fail(sprintf('Method call at position %s not found!', $pos));
1205
1206
            return;
1207
        }
1208
1209
        $this->assertEquals($methodName, $calls[$pos][0], "Method '" . $methodName . "' is expected to be called at position " . $pos . '.');
1210
1211
        if ($params === null) {
1212
            return;
1213
        }
1214
1215
        $this->assertEquals($params, $calls[$pos][1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
1216
    }
1217
1218
    /**
1219
     * Assertion for the DI Container, check if the given definition contains a method call with the given parameters.

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 919-933 (lines=15) @@
916
        $this->assertEquals($args, $definition->getArguments(), "Expected and actual DIC Service constructor arguments of definition '" . $definition->getClass() . "' don't match.");
917
    }
918
919
    private function assertDICDefinitionMethodCallAt(int $pos, Definition $definition, string $methodName, array $params = null) : void
920
    {
921
        $calls = $definition->getMethodCalls();
922
        if (! isset($calls[$pos][0])) {
923
            return;
924
        }
925
926
        $this->assertEquals($methodName, $calls[$pos][0], "Method '" . $methodName . "' is expected to be called at position " . $pos . '.');
927
928
        if ($params === null) {
929
            return;
930
        }
931
932
        $this->assertEquals($params, $calls[$pos][1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
933
    }
934
935
    /**
936
     * Assertion for the DI Container, check if the given definition contains a method call with the given parameters.