Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 806-829 (lines=24) @@
803
     * @param string     $methodName
804
     * @param array|null $params
805
     */
806
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
807
    {
808
        $calls  = $definition->getMethodCalls();
809
        $called = false;
810
        foreach ($calls as $call) {
811
            if ($call[0] !== $methodName) {
812
                continue;
813
            }
814
815
            if ($called) {
816
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
817
            } else {
818
                $called = true;
819
                if ($params !== null) {
820
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
821
                }
822
            }
823
        }
824
        if ($called) {
825
            return;
826
        }
827
828
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
829
    }
830
831
    private function compileContainer(ContainerBuilder $container)
832
    {

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

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