Completed
Pull Request — develop (#2)
by Léo
04:31
created

TwitterSeoConfiguratorTest::testSite()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Leogout\Bundle\SeoBundle\Tests\Seo\Twitter;
4
5
use Leogout\Bundle\SeoBundle\Builder\TagBuilder;
6
use Leogout\Bundle\SeoBundle\Factory\TagFactory;
7
use Leogout\Bundle\SeoBundle\Seo\Twitter\TwitterSeoConfigurator;
8
use Leogout\Bundle\SeoBundle\Seo\Twitter\TwitterSeoGenerator;
9
use Leogout\Bundle\SeoBundle\Tests\TestCase;
10
11
/**
12
 * Description of TwitterSeoConfiguratorTest.
13
 *
14
 * @author: leogout
15
 */
16
class TwitterSeoConfiguratorTest extends TestCase
17
{
18
    /**
19
     * @var TwitterSeoGenerator
20
     */
21
    protected $generator;
22
23
    protected function setUp()
24
    {
25
        $this->generator = new TwitterSeoGenerator(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 TwitterSeoConfigurator($config);
35
        $configurator->configure($this->generator);
36
37
        $this->assertEquals(
38
            '<meta name="twitter:title" content="Awesome | Site" />',
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 TwitterSeoConfigurator($config);
50
        $configurator->configure($this->generator);
51
52
        $this->assertEquals(
53
            '<meta name="twitter:description" content="My awesome site is so cool!" />',
54
            $this->generator->render()
55
        );
56
    }
57
58 View Code Duplication
    public function testImage()
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
            'image' => 'http://images.com/poney/12',
62
        ];
63
64
        $configurator = new TwitterSeoConfigurator($config);
65
        $configurator->configure($this->generator);
66
67
        $this->assertEquals(
68
            '<meta name="twitter:image" content="http://images.com/poney/12" />',
69
            $this->generator->render()
70
        );
71
    }
72
73 View Code Duplication
    public function testCard()
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
            'card' => 'summary',
77
        ];
78
79
        $configurator = new TwitterSeoConfigurator($config);
80
        $configurator->configure($this->generator);
81
82
        $this->assertEquals(
83
            '<meta name="twitter:card" content="summary" />',
84
            $this->generator->render()
85
        );
86
    }
87
88 View Code Duplication
    public function testSite()
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...
89
    {
90
        $config = [
91
            'site' => '@leogoutt',
92
        ];
93
94
        $configurator = new TwitterSeoConfigurator($config);
95
        $configurator->configure($this->generator);
96
97
        $this->assertEquals(
98
            '<meta name="twitter:site" content="@leogoutt" />',
99
            $this->generator->render()
100
        );
101
    }
102
103 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...
104
    {
105
        $config = [];
106
107
        $configurator = new TwitterSeoConfigurator($config);
108
        $configurator->configure($this->generator);
109
110
        $this->assertEquals(
111
            '',
112
            $this->generator->render()
113
        );
114
    }
115
}
116