Completed
Push — master ( 382b22...57bef4 )
by Pavel
02:35
created

ContainerTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 8

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getKernelClass() 0 4 1
B testContainerBuilding() 0 25 1
1
<?php
2
3
namespace Bankiru\Seo\Tests\Bundle;
4
5
use Bankiru\Seo\Destination;
6
use Bankiru\Seo\Entity\TargetDefinition;
7
use Bankiru\Seo\Integration\Local\StaticPageRepository;
8
use Bankiru\Seo\Integration\Local\StaticTargetRepository;
9
use Bankiru\Seo\Page\SeoPageBuilder;
10
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
11
12
class ContainerTest extends KernelTestCase
13
{
14
    protected static function getKernelClass()
15
    {
16
        return SeoKernel::class;
17
    }
18
19
    public function testContainerBuilding()
20
    {
21
        static::bootKernel();
22
        $container = static::$kernel->getContainer();
23
        self::assertNotNull($container);
24
25
        $route = 'test_route';
26
27
        $target      = new TargetDefinition($route);
28
        $destination = new Destination($route, []);
29
        $page        = (new SeoPageBuilder())->setTitle('Title')->getSeoPage();
30
31
        $targetRepo = new StaticTargetRepository();
32
        $pageRepo   = new StaticPageRepository();
33
        $container->set('bankiru.seo.target_repository', $targetRepo);
34
        $container->set('bankiru.seo.page_repository', $pageRepo);
35
36
        $targetRepo->add($target);
37
        $pageRepo->add($target, $page);
38
39
        $matcher = $container->get('bankiru.seo.matcher');
40
        self::assertSame($page, $matcher->match($destination));
41
42
        self::assertTrue($container->has('bankiru.seo.request_listener'));
43
    }
44
}
45