Completed
Push — sf_cache ( 2ab7b9...1dda70 )
by André
13:17
created

EnvTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testVerifyCacheDriver() 0 17 2
1
<?php
2
3
/**
4
 * File containing the EnvTest class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\API\Repository\Tests\Regression;
10
11
use eZ\Publish\API\Repository\Tests\BaseTest;
12
13
/**
14
 * Test case to verify Integration tests are setup with the right instances.
15
 */
16
class EnvTest extends BaseTest
17
{
18
    /**
19
     * Verify Redis cache is setup if asked for, if not file system
20
     */
21
    public function testVerifyCacheDriver()
22
    {
23
        /** @var \Stash\Pool $pool */
24
        $pool = $this->getSetupFactory()->getServiceContainer()->get('ezpublish.cache_pool');
25
26
        $this->assertInstanceOf('\Symfony\Component\Cache\Adapter\TagAwareAdapter', $pool);
27
28
        $reflectionPool = new \ReflectionProperty ($pool, 'itemsAdapter');
29
        $reflectionPool->setAccessible(true);
30
        $innerPool = $reflectionPool->getValue($pool);
31
32
        if (getenv('CUSTOM_CACHE_POOL') === 'singleredis') {
33
            $this->assertInstanceOf('\Symfony\Component\Cache\Adapter\RedisAdapter', $innerPool);
34
        } else {
35
            $this->assertInstanceOf('\Symfony\Component\Cache\Adapter\FilesystemAdapter', $innerPool);
36
        }
37
    }
38
}
39