1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Tests; |
4
|
|
|
|
5
|
|
|
use JumpGate\Menu\Link; |
6
|
|
|
use PHPUnit\Framework\TestCase; |
7
|
|
|
|
8
|
|
|
class LinkTest extends TestCase |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @var \JumpGate\Menu\Link |
12
|
|
|
*/ |
13
|
|
|
protected $link; |
14
|
|
|
|
15
|
7 |
|
public function setUp() |
16
|
|
|
{ |
17
|
7 |
|
parent::setUp(); |
18
|
|
|
|
19
|
7 |
|
$this->link = new Link(); |
20
|
7 |
|
} |
21
|
|
|
|
22
|
|
|
/** @test */ |
23
|
1 |
|
public function it_checks_set_url() |
24
|
|
|
{ |
25
|
1 |
|
$this->link->url = 'testUrl'; |
26
|
|
|
|
27
|
1 |
|
$this->assertEquals('testUrl', $this->link->url); |
28
|
1 |
|
} |
29
|
|
|
|
30
|
|
|
/** @test */ |
31
|
1 |
|
public function it_checks_set_active() |
32
|
|
|
{ |
33
|
1 |
|
$this->link->setActive(true); |
34
|
|
|
|
35
|
1 |
|
$this->assertTrue($this->link->active); |
36
|
1 |
|
} |
37
|
|
|
|
38
|
|
|
/** @test */ |
39
|
2 |
|
public function it_checks_not_active() |
40
|
|
|
{ |
41
|
1 |
|
$this->link->setActive(false); |
42
|
|
|
|
43
|
1 |
|
$this->assertFalse($this->link->active); |
44
|
2 |
|
} |
45
|
|
|
|
46
|
|
|
/** @test */ |
47
|
1 |
|
public function it_checks_set_options() |
48
|
|
|
{ |
49
|
1 |
|
$this->link->options = ['data' => 'dataOne']; |
50
|
|
|
|
51
|
1 |
|
$this->assertArrayHasKey('data', $this->link->options); |
52
|
1 |
|
$this->assertEquals('data', array_search('dataOne', $this->link->options)); |
53
|
1 |
|
} |
54
|
|
|
|
55
|
|
|
/** @test */ |
56
|
1 |
|
public function it_checks_is_dropdown() |
57
|
|
|
{ |
58
|
1 |
|
$this->assertFalse($this->link->isDropDown()); |
59
|
1 |
|
} |
60
|
|
|
|
61
|
|
|
/** @test */ |
62
|
1 |
|
public function it_checks_get_options_method() |
63
|
|
|
{ |
64
|
1 |
|
$this->link->options = ['test' => 'testValue']; |
65
|
|
|
|
66
|
1 |
|
$this->assertEquals('testValue', $this->link->getOption('test')); |
67
|
1 |
|
} |
68
|
|
|
|
69
|
|
|
/** @test */ |
70
|
1 |
|
public function it_checks_get_options_method_invalid_option() |
71
|
|
|
{ |
72
|
1 |
|
$this->link->options = []; |
73
|
|
|
|
74
|
1 |
|
$this->assertFalse($this->link->getOption('test')); |
75
|
1 |
|
} |
76
|
|
|
} |
77
|
|
|
|