Code Duplication    Length = 20-20 lines in 2 locations

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1011-1030 (lines=20) @@
1008
     * @param string     $methodName
1009
     * @param array      $params
1010
     */
1011
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
1012
    {
1013
        $calls = $definition->getMethodCalls();
1014
        $called = false;
1015
        foreach ($calls as $call) {
1016
            if ($call[0] == $methodName) {
1017
                if ($called) {
1018
                    $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though.");
1019
                } else {
1020
                    $called = true;
1021
                    if ($params !== null) {
1022
                        $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
1023
                    }
1024
                }
1025
            }
1026
        }
1027
        if (!$called) {
1028
            $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though.");
1029
        }
1030
    }
1031
1032
    private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = array(), $nbCalls = 1)
1033
    {

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

@@ 797-816 (lines=20) @@
794
     * @param string     $methodName
795
     * @param array|null $params
796
     */
797
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
798
    {
799
        $calls = $definition->getMethodCalls();
800
        $called = false;
801
        foreach ($calls as $call) {
802
            if ($call[0] === $methodName) {
803
                if ($called) {
804
                    $this->fail("Method '".$methodName."' is expected to be called only once, a second call was registered though.");
805
                } else {
806
                    $called = true;
807
                    if ($params !== null) {
808
                        $this->assertEquals($params, $call[1], "Expected parameters to methods '".$methodName."' do not match the actual parameters.");
809
                    }
810
                }
811
            }
812
        }
813
        if (!$called) {
814
            $this->fail("Method '".$methodName."' is expected to be called once, definition does not contain a call though.");
815
        }
816
    }
817
818
    private function compileContainer(ContainerBuilder $container)
819
    {