LinkedVisitorTestCase   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 38
Duplicated Lines 50 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 19
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testVisitNext() 19 19 1
visitNextDataProvider() 0 1 ?

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * This file is part of the Cubiche package.
4
 *
5
 * Copyright (c) Cubiche
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace Cubiche\Core\Visitor\Tests\Units;
11
12
use Cubiche\Core\Visitor\LinkedVisitor;
13
use Cubiche\Core\Visitor\VisiteeInterface;
14
15
/**
16
 * Linked Visitor Test Case Class.
17
 *
18
 * @author Karel Osorio Ramírez <[email protected]>
19
 */
20
abstract class LinkedVisitorTestCase extends DynamicDispatchVisitorTestCase
21
{
22
    /**
23
     * Test visit method.
24
     *
25
     * @param LinkedVisitor    $visitor
26
     * @param LinkedVisitor    $next
27
     * @param VisiteeInterface $visitee
28
     * @param string           $visitorMethod
29
     * @param mixed            $expected
30
     *
31
     * @dataProvider visitNextDataProvider
32
     */
33 View Code Duplication
    public function testVisitNext(
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
34
        LinkedVisitor $visitor,
35
        LinkedVisitor $next,
36
        VisiteeInterface $visitee,
37
        $visitorMethod,
38
        $expected
39
    ) {
40
        $this
41
            ->given($visitor, $visitee)
42
            ->when($result = $visitor->visit($visitee))
43
            ->then()
44
                ->mock($next)
45
                    ->call($visitorMethod)
46
                        ->withArguments($visitee)
47
                            ->once()
48
                ->variable($result)
49
                    ->isEqualTo($expected)
50
        ;
51
    }
52
53
    /**
54
     * @return array
55
     */
56
    abstract protected function visitNextDataProvider();
57
}
58