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

OgSeoConfiguratorTest::testImage()   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\Og;
4
5
use Leogout\Bundle\SeoBundle\Builder\TagBuilder;
6
use Leogout\Bundle\SeoBundle\Factory\TagFactory;
7
use Leogout\Bundle\SeoBundle\Seo\Og\OgSeoConfigurator;
8
use Leogout\Bundle\SeoBundle\Seo\Og\OgSeoGenerator;
9
use Leogout\Bundle\SeoBundle\Tests\TestCase;
10
11
/**
12
 * Description of OgSeoConfiguratorTest.
13
 *
14
 * @author: leogout
15
 */
16
class OgSeoConfiguratorTest extends TestCase
17
{
18
    /**
19
     * @var OgSeoGenerator
20
     */
21
    protected $generator;
22
23
    protected function setUp()
24
    {
25
        $this->generator = new OgSeoGenerator(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 OgSeoConfigurator($config);
35
        $configurator->configure($this->generator);
36
37
        $this->assertEquals(
38
            '<meta name="og: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 OgSeoConfigurator($config);
50
        $configurator->configure($this->generator);
51
52
        $this->assertEquals(
53
            '<meta name="og: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 OgSeoConfigurator($config);
65
        $configurator->configure($this->generator);
66
67
        $this->assertEquals(
68
            '<meta name="og:image" content="http://images.com/poney/12" />',
69
            $this->generator->render()
70
        );
71
    }
72
73 View Code Duplication
    public function testType()
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
            'type' => 'website',
77
        ];
78
79
        $configurator = new OgSeoConfigurator($config);
80
        $configurator->configure($this->generator);
81
82
        $this->assertEquals(
83
            '<meta name="og:type" content="website" />',
84
            $this->generator->render()
85
        );
86
    }
87
88 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...
89
    {
90
        $config = [];
91
92
        $configurator = new OgSeoConfigurator($config);
93
        $configurator->configure($this->generator);
94
95
        $this->assertEquals(
96
            '',
97
            $this->generator->render()
98
        );
99
    }
100
}
101