Completed
Branch master (0b86d9)
by Léo
02:17
created

testGetUndefinedGenerator()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
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\Provider\SeoGeneratorProvider;
8
use Leogout\Bundle\SeoBundle\Seo\Basic\BasicSeoGenerator;
9
use Leogout\Bundle\SeoBundle\Tests\TestCase;
10
11
/**
12
 * Description of SeoGeneratorProviderTest.
13
 *
14
 * @author: leogout
15
 */
16
class SeoGeneratorProviderTest extends TestCase
17
{
18
    /**
19
     * @var SeoGeneratorProvider
20
     */
21
    protected $provider;
22
23
    protected function setUp()
24
    {
25
        $tagBuilder = new TagBuilder(new TagFactory());
26
        $basicGenerator = new BasicSeoGenerator($tagBuilder);
27
28
        $this->provider = new SeoGeneratorProvider([
29
            'basic' => $basicGenerator,
30
        ]);
31
    }
32
33
    public function testGetGenerator()
34
    {
35
        $this->assertInstanceOf(
36
            BasicSeoGenerator::class,
37
            $this->provider->get('basic')
38
        );
39
    }
40
41
    /**
42
     * @expectedException \InvalidArgumentException
43
     * @expectedExceptionMessage The SEO generator with alias "undefined" is not defined.
44
     */
45
    public function testGetUndefinedGenerator()
46
    {
47
        $this->provider->get('undefined');
48
    }
49
50
    public function testGetAllGenerators()
51
    {
52
        $this->assertInstanceOf(
53
            BasicSeoGenerator::class,
54
            $this->provider->getAll()['basic']
55
        );
56
    }
57
58
    /**
59
     * @param
60
     */
61
    public function testHasGenerator()
62
    {
63
        $this->assertTrue(
64
            $this->provider->has('basic')
65
        );
66
        $this->assertFalse(
67
            $this->provider->has('undefined')
68
        );
69
    }
70
}
71