Completed
Push — master ( 4cc5fa...c5aa1b )
by Brandon
01:27
created

MenuTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 61
ccs 22
cts 22
cp 1
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 4

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A it_sets_the_name() 0 6 1
A it_sets_default_name() 0 6 1
A it_test_get_dropdown() 0 16 1
A it_test_get_dropdown_exception() 0 6 1
1
<?php
2
3
namespace Tests;
4
5
use JumpGate\Menu\DropDown;
6
use JumpGate\Menu\Menu;
7
use PHPUnit\Framework\TestCase;
8
9
class MenuTest extends TestCase
10
{
11
    /**
12
     * @var \JumpGate\Menu\Menu
13
     */
14
    protected $menu;
15
16 4
    public function setUp()
17
    {
18 4
        parent::setUp();
19
20 4
        $this->menu = new Menu();
21 4
    }
22
23
    /** @test */
24 1
    public function it_sets_the_name()
25
    {
26 1
        $this->menu->name = 'testName';
27
28 1
        $this->assertEquals('testName', $this->menu->name);
29 1
    }
30
31
    /** @test */
32 1
    public function it_sets_default_name()
33
    {
34 1
        $menu = new Menu('testDefault');
35
36 1
        $this->assertEquals('testDefault', $menu->name);
37 1
    }
38
39
    /** @test */
40
    public function it_test_get_dropdown()
41
    {
42
        $this->menu->dropdown('slug', 'name', function (DropDown $dropDown) {
43 1
            $dropDown->link('slug2', function () {
44
                //
45 1
            });
46 1
        });
47
48
        $this->menu->getDropDown('slug', function (DropDown $dropDown) {
49 1
            $dropDown->link('slug3', function () {
50
                //
51 1
            });
52 1
        });
53
54 1
        $this->assertCount(2, $this->menu->links->first()->links);
55 1
    }
56
57
    /**
58
     * @test
59
     *
60
     * @expectedException Exception
61
     * @expectedExceptionMessage Drop down test not found.
62
     */
63
    public function it_test_get_dropdown_exception()
64
    {
65 1
        $this->menu->getDropDown('test', function () {
66
            //
67 1
        });
68
    }
69
}
70