Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

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

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 865-888 (lines=24) @@
862
     * @param string     $methodName
863
     * @param array|null $params
864
     */
865
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
866
    {
867
        $calls  = $definition->getMethodCalls();
868
        $called = false;
869
        foreach ($calls as $call) {
870
            if ($call[0] !== $methodName) {
871
                continue;
872
            }
873
874
            if ($called) {
875
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
876
            } else {
877
                $called = true;
878
                if ($params !== null) {
879
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
880
                }
881
            }
882
        }
883
        if ($called) {
884
            return;
885
        }
886
887
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
888
    }
889
890
    private function compileContainer(ContainerBuilder $container)
891
    {