Completed
Push — master ( 6c5077...d22a37 )
by Christian
01:33
created

DefinitionManagerTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testItIsInstantiable() 0 6 1
A testAddDefintion() 0 15 2
1
<?php
2
3
/*
4
 * (c) Christian Gripp <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Core23\SitemapBundle\Tests\Definition;
11
12
use Core23\SitemapBundle\Definition\DefintionManager;
13
use Core23\SitemapBundle\Definition\DefintionManagerInterface;
14
use Core23\SitemapBundle\Definition\SitemapDefinition;
15
use PHPUnit\Framework\TestCase;
16
17
class DefinitionManagerTest extends TestCase
18
{
19
    public function testItIsInstantiable(): void
20
    {
21
        $definition = new DefintionManager();
22
23
        $this->assertInstanceOf(DefintionManagerInterface::class, $definition);
24
    }
25
26
    public function testAddDefintion(): void
27
    {
28
        $definition = new DefintionManager();
29
        $definition->addDefinition('foo.definition', [
30
            'foo' => 'bar',
31
        ]);
32
33
        foreach ($definition->getAll() as $id =>  $item) {
34
            $this->assertInstanceOf(SitemapDefinition::class, $item);
35
            $this->assertSame('foo.definition', $id);
36
            $this->assertSame([
37
                'foo' => 'bar',
38
            ], $item->getSettings());
39
        }
40
    }
41
}
42