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

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