Completed
Push — master ( 51af85...b489fc )
by Pavel
06:35
created

ContainerTest::getKernelClass()   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 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
}
43