ConfigureMenuEventTest::tearDown()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SumoCoders\FrameworkCoreBundle\Tests\Event;
4
5
use Knp\Menu\FactoryInterface;
6
use Knp\Menu\ItemInterface;
7
use SumoCoders\FrameworkCoreBundle\Event\ConfigureMenuEvent;
8
9
class ConfigureMenuEventTest extends \PHPUnit_Framework_TestCase
10
{
11
    /**
12
     * @var ConfigureMenuEvent
13
     */
14
    protected $configureMenuEvent;
15
16
    /**
17
     * @inherit
18
     */
19
    protected function setUp()
20
    {
21
        $this->configureMenuEvent = new ConfigureMenuEvent(
22
            $this->getFactory(),
23
            $this->getItem()
24
        );
25
    }
26
27
    /**
28
     * @return \PHPUnit_Framework_MockObject_MockObject
29
     */
30
    protected function getFactory()
31
    {
32
        $factory = $this->getMockBuilder(FactoryInterface::class)->getMock();
33
34
        return $factory;
35
    }
36
37
    /**
38
     * @return \PHPUnit_Framework_MockObject_MockObject
39
     */
40
    protected function getItem()
41
    {
42
        $item = $this->getMockBuilder(ItemInterface::class)->getMock();
43
44
        return $item;
45
    }
46
47
    /**
48
     * @inherit
49
     */
50
    protected function tearDown()
51
    {
52
        $this->configureMenuEvent = null;
53
    }
54
55
    /**
56
     * Test FrameworkExtension->getName()
57
     */
58
    public function testName()
59
    {
60
        $this->assertEquals('framework_core.configure_menu', ConfigureMenuEvent::EVENT_NAME);
61
    }
62
63
    /**
64
     * Test the getters and setters
65
     */
66
    public function testGettersAndSetters()
67
    {
68
        $this->assertEquals($this->getFactory(), $this->configureMenuEvent->getFactory());
69
        $this->assertEquals($this->getItem(), $this->configureMenuEvent->getMenu());
70
    }
71
}
72