Code Duplication    Length = 24-24 lines in 2 locations

Tests/DependencyInjection/DoctrineExtensionTest.php 1 location

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

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php 1 location

@@ 1029-1052 (lines=24) @@
1026
     * @param string $methodName
1027
     * @param array  $params
1028
     */
1029
    private function assertDICDefinitionMethodCallOnce(Definition $definition, $methodName, array $params = null)
1030
    {
1031
        $calls  = $definition->getMethodCalls();
1032
        $called = false;
1033
        foreach ($calls as $call) {
1034
            if ($call[0] !== $methodName) {
1035
                continue;
1036
            }
1037
1038
            if ($called) {
1039
                $this->fail("Method '" . $methodName . "' is expected to be called only once, a second call was registered though.");
1040
            } else {
1041
                $called = true;
1042
                if ($params !== null) {
1043
                    $this->assertEquals($params, $call[1], "Expected parameters to methods '" . $methodName . "' do not match the actual parameters.");
1044
                }
1045
            }
1046
        }
1047
        if ($called) {
1048
            return;
1049
        }
1050
1051
        $this->fail("Method '" . $methodName . "' is expected to be called once, definition does not contain a call though.");
1052
    }
1053
1054
    private function assertDICDefinitionMethodCallCount(Definition $definition, $methodName, array $params = [], $nbCalls = 1)
1055
    {