LinkTagTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 52
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testRenderAll() 0 14 1
A testRenderHrefAndRel() 0 12 1
A testRenderTypeAndTitle() 0 12 1
A testRenderNothing() 0 8 1
1
<?php
2
3
namespace Leogout\Bundle\SeoBundle\Tests\Model;
4
5
use Leogout\Bundle\SeoBundle\Model\LinkTag;
6
use Leogout\Bundle\SeoBundle\Tests\TestCase;
7
8
/**
9
 * Description of LinkTagTest.
10
 *
11
 * @author: leogout
12
 */
13
class LinkTagTest extends TestCase
14
{
15
    public function testRenderAll()
16
    {
17
        $linkTag = new LinkTag();
18
        $linkTag
19
            ->setHref('http://symfony.com/blog')
20
            ->setRel('alternate')
21
            ->setType('application/rss+xml')
22
            ->setTitle('RSS');
23
24
        $this->assertEquals(
25
            '<link href="http://symfony.com/blog" rel="alternate" type="application/rss+xml" title="RSS" />',
26
            $linkTag->render()
27
        );
28
    }
29
30
    public function testRenderHrefAndRel()
31
    {
32
        $linkTag = new LinkTag();
33
        $linkTag
34
            ->setHref('http://symfony.com/blog')
35
            ->setRel('alternate');
36
37
        $this->assertEquals(
38
            '<link href="http://symfony.com/blog" rel="alternate" />',
39
            $linkTag->render()
40
        );
41
    }
42
43
    public function testRenderTypeAndTitle()
44
    {
45
        $linkTag = new LinkTag();
46
        $linkTag
47
            ->setType('application/rss+xml')
48
            ->setTitle('RSS');
49
50
        $this->assertEquals(
51
            '<link type="application/rss+xml" title="RSS" />',
52
            $linkTag->render()
53
        );
54
    }
55
56
    public function testRenderNothing()
57
    {
58
        $linkTag = new LinkTag();
59
        $this->assertEquals(
60
            '<link />',
61
            $linkTag->render()
62
        );
63
    }
64
}
65