Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

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

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 780-803 (lines=24) @@
777
     * @param string     $methodName
778
     * @param array|null $params
779
     */
780
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
781
    {
782
        $calls  = $definition->getMethodCalls();
783
        $called = false;
784
        foreach ($calls as $call) {
785
            if ($call[0] !== $methodName) {
786
                continue;
787
            }
788
789
            if ($called) {
790
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
791
            } else {
792
                $called = true;
793
                if ($params !== null) {
794
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
795
                }
796
            }
797
        }
798
        if ($called) {
799
            return;
800
        }
801
802
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
803
    }
804
805
    private function compileContainer(ContainerBuilder $container)
806
    {