Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

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

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

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