LinkTagTest::testRenderAll()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 10
nc 1
nop 0
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