Completed
Push — master ( 52f128...550102 )
by Travis
02:39
created

MenuTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 4
cts 4
cp 1
crap 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 1
    public function it_test_get_dropdown()
41
    {
42
        $this->menu->dropdown('slug', 'name', function (DropDown $dropDown) {
43
            $dropDown->link('slug2', function () {
44
                //
45 1
            });
46 1
        });
47
48
        $this->menu->getDropDown('slug', function (DropDown $dropDown) {
49
            $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