Completed
Push — master ( 82d1fc...6f9908 )
by Ivannis Suárez
02:50 queued 29s
created

LinkedVisitorTestCase::testVisitNext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 19
Code Lines 16

Duplication

Lines 19
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 19
loc 19
rs 9.4285
cc 1
eloc 16
nc 1
nop 5
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