Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

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

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

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