Completed
Push — master ( b76799...7a23f8 )
by Tobias
44:51 queued 19:58
created

BundleInitializationTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of php-cache organization.
5
 *
6
 * (c) 2015-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\AdapterBundle\Tests\Functional;
13
14
use Cache\Adapter\Apc\ApcCachePool;
15
use Cache\Adapter\Apcu\ApcuCachePool;
16
use Cache\Adapter\Chain\CachePoolChain;
17
use Cache\Adapter\Doctrine\DoctrineCachePool;
18
use Cache\Adapter\Memcache\MemcacheCachePool;
19
use Cache\Adapter\Memcached\MemcachedCachePool;
20
use Cache\Adapter\PHPArray\ArrayCachePool;
21
use Cache\Adapter\Predis\PredisCachePool;
22
use Cache\Adapter\Redis\RedisCachePool;
23
use Cache\Adapter\Void\VoidCachePool;
24
use Cache\AdapterBundle\CacheAdapterBundle;
25
use Nyholm\BundleTest\BaseBundleTestCase;
26
27
class BundleInitializationTest extends BaseBundleTestCase
28
{
29
    protected function getBundleClass()
30
    {
31
        return CacheAdapterBundle::class;
32
    }
33
34
    protected function setUp()
35
    {
36
        parent::setUp();
37
        $kernel = $this->createKernel();
38
        $kernel->addConfigFile(__DIR__.'/config.yml');
39
    }
40
41
    public function testFactoriesWithWithDefaultConfiguration()
42
    {
43
        $this->bootKernel();
44
        $container = $this->getContainer();
45
        $this->assertInstanceOf(ArrayCachePool::class, $container->get('alias.my_adapter'));
46
        $this->assertInstanceOf(ApcCachePool::class, $container->get('cache.provider.apc'));
47
        $this->assertInstanceOf(ApcuCachePool::class, $container->get('cache.provider.apcu'));
48
        $this->assertInstanceOf(ArrayCachePool::class, $container->get('cache.provider.array'));
49
        $this->assertInstanceOf(CachePoolChain::class, $container->get('cache.provider.chain'));
50
        $this->assertInstanceOf(PredisCachePool::class, $container->get('cache.provider.predis'));
51
        $this->assertInstanceOf(VoidCachePool::class, $container->get('cache.provider.void'));
52
53
        $this->assertInstanceOf(DoctrineCachePool::class, $container->get('cache.provider.doctrine_filesystem'));
54
        $this->assertInstanceOf(DoctrineCachePool::class, $container->get('cache.provider.doctrine_predis'));
55
    }
56
57 View Code Duplication
    public function testMemcachedWithWithDefaultConfiguration()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        if (!class_exists('Memcached')) {
60
            $this->markTestSkipped('Skipping since Memcached is not installed.');
61
        }
62
        $this->bootKernel();
63
        $container = $this->getContainer();
64
        $this->assertInstanceOf(MemcachedCachePool::class, $container->get('cache.provider.memcached'));
65
        $this->assertInstanceOf(DoctrineCachePool::class, $container->get('cache.provider.doctrine_memcached'));
66
    }
67
68 View Code Duplication
    public function testMemcacheWithWithDefaultConfiguration()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
69
    {
70
        if (!class_exists('Memcache')) {
71
            $this->markTestSkipped('Skipping since Memcache is not installed.');
72
        }
73
        $this->bootKernel();
74
        $container = $this->getContainer();
75
        $this->assertInstanceOf(MemcacheCachePool::class, $container->get('cache.provider.memcache'));
76
        $this->assertInstanceOf(DoctrineCachePool::class, $container->get('cache.provider.doctrine_memcache'));
77
    }
78
79 View Code Duplication
    public function testRedisWithWithDefaultConfiguration()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
    {
81
        if (!class_exists('Redis')) {
82
            $this->markTestSkipped('Skipping since Memcache is not installed.');
83
        }
84
85
        $this->bootKernel();
86
        $container = $this->getContainer();
87
        $this->assertInstanceOf(RedisCachePool::class, $container->get('cache.provider.redis'));
88
        $this->assertInstanceOf(DoctrineCachePool::class, $container->get('cache.provider.doctrine_redis'));
89
    }
90
}
91