Completed
Push — develop ( dcf765...a9e6df )
by Léo
11s
created

BasicSeoConfiguratorTest::testDisableAll()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 17
nc 1
nop 0
1
<?php
2
3
namespace Leogout\Bundle\SeoBundle\Tests\Seo\Basic;
4
5
use Leogout\Bundle\SeoBundle\Builder\TagBuilder;
6
use Leogout\Bundle\SeoBundle\Factory\TagFactory;
7
use Leogout\Bundle\SeoBundle\Seo\Basic\BasicSeoConfigurator;
8
use Leogout\Bundle\SeoBundle\Seo\Basic\BasicSeoGenerator;
9
use Leogout\Bundle\SeoBundle\Tests\TestCase;
10
11
/**
12
 * Description of BasicSeoConfiguratorTest.
13
 *
14
 * @author: leogout
15
 */
16
class BasicSeoConfiguratorTest extends TestCase
17
{
18
    /**
19
     * @var BasicSeoGenerator
20
     */
21
    protected $generator;
22
23
    protected function setUp()
24
    {
25
        $this->generator = new BasicSeoGenerator(new TagBuilder(new TagFactory()));
26
    }
27
28 View Code Duplication
    public function testTitle()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
29
    {
30
        $config = [
31
            'title' => 'Awesome | Site'
32
        ];
33
34
        $configurator = new BasicSeoConfigurator($config);
35
        $configurator->configure($this->generator);
36
37
        $this->assertEquals(
38
            '<title>Awesome | Site</title>',
39
            $this->generator->render()
40
        );
41
    }
42
43 View Code Duplication
    public function testDescription()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        $config = [
46
            'description' => 'My awesome site is so cool!',
47
        ];
48
49
        $configurator = new BasicSeoConfigurator($config);
50
        $configurator->configure($this->generator);
51
52
        $this->assertEquals(
53
            '<meta name="description" content="My awesome site is so cool!" />',
54
            $this->generator->render()
55
        );
56
    }
57
58 View Code Duplication
    public function testKeywords()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $config = [
61
            'keywords' => 'awesome, cool',
62
        ];
63
64
        $configurator = new BasicSeoConfigurator($config);
65
        $configurator->configure($this->generator);
66
67
        $this->assertEquals(
68
            '<meta name="keywords" content="awesome, cool" />',
69
            $this->generator->render()
70
        );
71
    }
72
73 View Code Duplication
    public function testCanonical()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
74
    {
75
        $config = [
76
            'canonical' => 'http://127.0.0.1:8000',
77
        ];
78
79
        $configurator = new BasicSeoConfigurator($config);
80
        $configurator->configure($this->generator);
81
82
        $this->assertEquals(
83
            '<link href="http://127.0.0.1:8000" rel="canonical" />',
84
            $this->generator->render()
85
        );
86
    }
87
88
    public function testRobots()
89
    {
90
        $config = [
91
            'robots' => [
92
                'index' => true,
93
                'follow' => true,
94
            ],
95
        ];
96
97
        $configurator = new BasicSeoConfigurator($config);
98
        $configurator->configure($this->generator);
99
100
        $this->assertEquals(
101
            '<meta name="robots" content="index, follow" />',
102
            $this->generator->render()
103
        );
104
    }
105
106 View Code Duplication
    public function testNoConfig()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
107
    {
108
        $config = [];
109
110
        $configurator = new BasicSeoConfigurator($config);
111
        $configurator->configure($this->generator);
112
113
        $this->assertEquals(
114
            '',
115
            $this->generator->render()
116
        );
117
    }
118
}
119