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

@@ 847-870 (lines=24) @@
844
     * @param string     $methodName
845
     * @param array|null $params
846
     */
847
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
848
    {
849
        $calls  = $definition->getMethodCalls();
850
        $called = false;
851
        foreach ($calls as $call) {
852
            if ($call[0] !== $methodName) {
853
                continue;
854
            }
855
856
            if ($called) {
857
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
858
            } else {
859
                $called = true;
860
                if ($params !== null) {
861
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
862
                }
863
            }
864
        }
865
        if ($called) {
866
            return;
867
        }
868
869
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
870
    }
871
872
    private function compileContainer(ContainerBuilder $container)
873
    {