Completed
Push — refactoring ( 84ac1f...ab1ebc )
by Oleg
04:25
created

ItemTest::itemFactory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Malezha\Menu\Tests;
4
5
use Malezha\Menu\Contracts\Builder;
6
use Malezha\Menu\Entity\Item;
7
use Malezha\Menu\Entity\Link;
8
9
class ItemTest extends TestCase
10
{
11
    protected function itemFactory()
12
    {
13
        $builder = $this->app->make(Builder::class, ['name' => 'test']);
14
        
15
        return new Item($builder, 'index', [], 'Index', '/index', ['class' => 'link']);
16
    }
17
18
    public function testLink()
19
    {
20
        $item = $this->itemFactory();
21
22
        $this->assertInstanceOf(Link::class, $item->getLink());
23
    }
24
    
25
    public function testBuildAttributes()
26
    {
27
        $item = $this->itemFactory();
28
        
29
        $this->assertInternalType('string', $item->buildAttributes());
30
    }
31
    
32
    public function testIsUrlEqual()
33
    {
34
        $item = $this->itemFactory();
35
        
36
        $first = url('/index');
37
        $second = url('/');
38
        
39
        $this->assertTrue($item->isUrlEqual($first, $second));
40
    }
41
}