Passed
Pull Request — master (#30)
by Alexander
02:06
created

WinCacheTest::createCacheInstance()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
namespace Yiisoft\CacheOld\Tests;
3
4
use Yiisoft\CacheOld\Cache;
5
use Yiisoft\CacheOld\CacheInterface;
6
use Yiisoft\CacheOld\WinCache;
7
8
/**
9
 * Class for testing wincache backend.
10
 * @group wincache
11
 * @group caching
12
 */
13
class WinCacheTest extends CacheTest
14
{
15
    public static function setUpBeforeClass(): void
16
    {
17
        if (!extension_loaded('wincache')) {
18
            self::markTestSkipped('Required extension "wincache" is not loaded');
19
        }
20
21
        if (!ini_get('wincache.enablecli')) {
22
            self::markTestSkipped('Wincache is installed but not enabled. Enable with "wincache.enablecli" from php.ini. Skipping.');
23
        }
24
25
        if (!ini_get('wincache.ucenabled')) {
26
            self::markTestSkipped('Wincache user cache disabled. Enable with "wincache.ucenabled" from php.ini. Skipping.');
27
        }
28
    }
29
30
    protected function createCacheInstance(): CacheInterface
31
    {
32
        return new Cache(new WinCache());
33
    }
34
}
35