BundleInitializationTest::testInitBundle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
rs 9.4285
cc 2
eloc 10
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of php-cache\cache-bundle package.
5
 *
6
 * (c) 2015 Aaron Scherer <[email protected]>, Tobias Nyholm <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Cache\CacheBundle\Tests\Functional;
13
14
use Cache\Bridge\Doctrine\DoctrineCacheBridge;
15
use Cache\CacheBundle\Bridge\SymfonyValidatorBridge;
16
use Cache\CacheBundle\CacheBundle;
17
use Cache\CacheBundle\Routing\CachingRouter;
18
use Cache\SessionHandler\Psr6SessionHandler;
19
use Nyholm\BundleTest\BaseBundleTestCase;
20
use Symfony\Component\HttpKernel\Kernel;
21
22
/**
23
 * @author Tobias Nyholm <[email protected]>
24
 */
25
class BundleInitializationTest extends BaseBundleTestCase
26
{
27
    protected function getBundleClass()
28
    {
29
        return CacheBundle::class;
30
    }
31
32
    protected function setUp()
33
    {
34
        parent::setUp();
35
        $kernel = $this->createKernel();
36
        $kernel->addConfigFile(__DIR__.'/config.yml');
37
38
        if (Kernel::MAJOR_VERSION < 4) {
39
            $kernel->addConfigFile(__DIR__.'/sf2_and_3.yml');
40
        }
41
    }
42
43
    public function testInitBundle()
44
    {
45
        $this->bootKernel();
46
        $container = $this->getContainer();
47
48
        $this->assertTrue($container->hasParameter('cache.provider_service_ids'));
49
50
        if (Kernel::MAJOR_VERSION < 4) {
51
            $this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.annotation'));
52
            $this->assertInstanceOf(DoctrineCacheBridge::class, $container->get('cache.service.serializer'));
53
            $this->assertInstanceOf(SymfonyValidatorBridge::class, $container->get('cache.service.validation'));
54
            $this->assertInstanceOf(Psr6SessionHandler::class, $container->get('cache.service.session'));
55
            $this->assertInstanceOf(CachingRouter::class, $container->get('cache.service.router'));
56
        }
57
    }
58
}
59