Completed
Push — master ( 15f051...29343b )
by Oleg
05:33
created

LinkTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 29
wmc 3
lcom 1
cbo 3
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A linkFactory() 0 6 1
A testTitle() 0 9 1
A testUrl() 0 9 1
1
<?php
2
3
namespace Malezha\Menu\Tests;
4
5
use Illuminate\Contracts\Routing\UrlGenerator;
6
use Malezha\Menu\Entity\Link;
7
8
class LinkTest extends TestCase
9
{
10
    protected function linkFactory()
11
    {
12
        return new Link('Home',
13
            $this->app->make(UrlGenerator::class)->to('/index'),
14
            ['class' => 'link']);
15
    }
16
17
    public function testTitle()
18
    {
19
        $link = $this->linkFactory();
20
21
        $this->assertEquals('Home', $link->getTitle());
22
23
        $link->setTitle('Index');
24
        $this->assertAttributeEquals('Index', 'title', $link);
25
    }
26
    
27
    public function testUrl()
28
    {
29
        $link = $this->linkFactory();
30
31
        $this->assertEquals('http://localhost/index', $link->getUrl());
32
        
33
        $link->setUrl('/home');
34
        $this->assertAttributeEquals('/home', 'url', $link);
35
    }
36
}