LinkedVisitorTestCase::visitNextDataProvider()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
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