Completed
Push — master ( dcf43c...59d132 )
by Tijs
06:54
created

ConfigureMenuEventTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 63
rs 10
c 0
b 0
f 0

6 Methods

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