Completed
Push — master ( 081637...206e0a )
by Eric
06:26
created

MenuBuilderEventTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 55
rs 10
1
<?php
2
3
/*
4
 * This file is part of the Lug package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Lug\Bundle\UiBundle\Tests\Menu;
13
14
use Knp\Menu\FactoryInterface;
15
use Knp\Menu\ItemInterface;
16
use Lug\Bundle\UiBundle\Menu\MenuBuilderEvent;
17
use Symfony\Component\EventDispatcher\Event;
18
19
/**
20
 * @author GeLo <[email protected]>
21
 */
22
class MenuBuilderEventTest extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * @var MenuBuilderEvent
26
     */
27
    private $event;
28
29
    /**
30
     * @var \PHPUnit_Framework_MockObject_MockObject|FactoryInterface
31
     */
32
    private $factory;
33
34
    /**
35
     * @var \PHPUnit_Framework_MockObject_MockObject|ItemInterface
36
     */
37
    private $item;
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function setUp()
43
    {
44
        $this->factory = $this->createFactoryMock();
45
        $this->item = $this->createItemMock();
46
47
        $this->event = new MenuBuilderEvent($this->factory, $this->item);
48
    }
49
50
    public function testInheritance()
51
    {
52
        $this->assertInstanceOf(Event::class, $this->event);
53
    }
54
55
    public function testDefaultState()
56
    {
57
        $this->assertSame($this->factory, $this->event->getFactory());
58
        $this->assertSame($this->item, $this->event->getItem());
59
    }
60
61
    /**
62
     * @return \PHPUnit_Framework_MockObject_MockObject|FactoryInterface
63
     */
64
    private function createFactoryMock()
65
    {
66
        return $this->getMock(FactoryInterface::class);
67
    }
68
69
    /**
70
     * @return \PHPUnit_Framework_MockObject_MockObject|ItemInterface
71
     */
72
    private function createItemMock()
73
    {
74
        return $this->getMock(ItemInterface::class);
75
    }
76
}
77