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

VisitorInterfaceTestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
c 3
b 0
f 1
lcom 2
cbo 2
dl 0
loc 29
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testClass() 0 7 1
A testVisitUnsupportedVisitee() 0 12 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\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