Completed
Push — master ( e91e9a...b4b292 )
by Alexander
01:49
created

ApcuCacheTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 8
dl 0
loc 26
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A createCacheInstance() 0 3 1
A setUpBeforeClass() 0 8 3
A testExpireAdd() 0 3 1
A testExpire() 0 3 1
1
<?php
2
namespace Yiisoft\Cache\Tests;
3
4
use Yiisoft\Cache\ApcuCache;
5
use Yiisoft\Cache\Cache;
6
use Yiisoft\Cache\CacheInterface;
7
8
/**
9
 * Class for testing APC cache backend
10
 * @group apc
11
 * @group caching
12
 */
13
class ApcuCacheTest extends CacheTest
14
{
15
    public static function setUpBeforeClass(): void
16
    {
17
        if (!extension_loaded('apcu')) {
18
            self::markTestSkipped('Required extension "apcu" is not loaded');
19
        }
20
21
        if (!ini_get('apc.enable_cli')) {
22
            self::markTestSkipped('APC is installed but not enabled. Enable with "apc.enable_cli" from php.ini. Skipping.');
23
        }
24
    }
25
26
    protected function createCacheInstance(): CacheInterface
27
    {
28
        return new Cache(new ApcuCache());
29
    }
30
31
    public function testExpire(): void
32
    {
33
        $this->markTestSkipped('APC keys are expiring only on the next request.');
34
    }
35
36
    public function testExpireAdd(): void
37
    {
38
        $this->markTestSkipped('APC keys are expiring only on the next request.');
39
    }
40
}
41