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

VisitorInterfaceTestCase::newMockVisiteeInterface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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\Tests\TestCase;
13
use Cubiche\Core\Visitor\VisitorInterface;
14
use Cubiche\Core\Visitor\VisiteeInterface;
15
16
/**
17
 * Visitor Interface Test Case Class.
18
 *
19
 * @author Karel Osorio Ramírez <[email protected]>
20
 */
21
abstract class VisitorInterfaceTestCase extends TestCase
22
{
23
    /**
24
     * Test class.
25
     */
26
    public function testClass()
27
    {
28
        $this
29
            ->testedClass
30
                ->implements(VisitorInterface::class)
31
        ;
32
    }
33
34
    /**
35
     * Test visit method.
36
     */
37
    public function testVisitUnsupportedVisitee()
38
    {
39
        $this
40
            ->given($visiteeMock = $this->newMockInstance(VisiteeInterface::class))
41
            /* @var \Cubiche\Core\Visitor\VisitorInterface $visitor */
42
            ->given($visitor = $this->newDefaultTestedInstance())
43
            ->exception(function () use ($visitor, $visiteeMock) {
44
                $visitor->visit($visiteeMock);
45
            })
46
                ->isInstanceOf(\LogicException::class)
47
        ;
48
    }
49
}
50