Test Failed
Push — master ( d844b5...1ec8b0 )
by Joao
34s
created

BaseCacheTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 14 and the first side effect is on line 7.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Test;
4
5
use ByJG\Cache\Psr6\CachePool;
6
7
require_once 'Model.php';
8
9
// backward compatibility
10
if (!class_exists('\PHPUnit\Framework\TestCase')) {
11
    class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase');
12
}
13
14
abstract class BaseCacheTest extends \PHPUnit\Framework\TestCase
15
{
16
    /**
17
     * @var \ByJG\Cache\Psr16\BaseCacheEngine
18
     */
19
    protected $cacheEngine = null;
20
21
    protected function setUp()
22
    {
23
24
    }
25
26
    protected function tearDown()
27
    {
28
        $this->cacheEngine->clear();
29
        $this->cacheEngine = null;
30
    }
31
32
    public function CachePoolProvider()
33
    {
34
        $memcachedServer = ['memcached-container:11211'];
35
        $redisCacheServer = 'redis-container:6379';
36
        $redisPassword = '';
37
38
        return [
39
            'Array'         => [
40
                new \ByJG\Cache\Psr16\ArrayCacheEngine()
41
            ],
42
            'FileSystem'    => [
43
                new \ByJG\Cache\Psr16\FileSystemCacheEngine()
44
            ],
45
            'ShmopCache'    => [
46
                new \ByJG\Cache\Psr16\ShmopCacheEngine()
47
            ],
48
            'SessionCache'  => [
49
                new \ByJG\Cache\Psr16\SessionCacheEngine()
50
            ],
51
            'NoCacheEngine' => [
52
                new \ByJG\Cache\Psr16\NoCacheEngine()
53
            ],
54
            'Memcached'     => [
55
                new \ByJG\Cache\Psr16\MemcachedEngine($memcachedServer)
56
            ],
57
            'Redis'         => [
58
                new \ByJG\Cache\Psr16\RedisCacheEngine($redisCacheServer, $redisPassword)
59
            ]
60
        ];
61
    }
62
}
63