PluginTest::testCreateCacheFile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 12
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
namespace Phile\Plugin\Phile\PhpFastCache\Tests;
4
5
use Phile\Core\Config;
6
use Phile\Test\TestCase;
7
use Phile\Core\ServiceLocator;
8
9
/**
10
 * Tests for Plugin class
11
 *
12
 * @link    https://philecms.github.io
13
 * @license http://opensource.org/licenses/MIT
14
 * @package Phile\Plugin\Phile\PhpFastCache\Tests
15
 */
16
class PluginTest extends TestCase
17
{
18 1
    public function testCreateCacheDefault()
19
    {
20 1
        $this->createPhileCore()->bootstrap();
21 1
        $cache = ServiceLocator::getService('Phile_Cache');
22 1
        $this->assertInstanceOf(
23
            \Phile\Plugin\Phile\PhpFastCache\PhileToPsr16CacheAdapter::class,
24
            $cache
25
        );
26
    }
27
28 1
    public function testCreateCacheFile()
29
    {
30 1
        $config = new Config([
31
            'plugins' => [
32 1
                'phile\\phpFastCache' => ['active' => true, 'storage' => 'files']
33
            ]
34
        ]);
35 1
        $this->createPhileCore(null, $config)->bootstrap();
36 1
        $cache = ServiceLocator::getService('Phile_Cache');
37 1
        $this->assertInstanceOf(
38
            \Phile\Plugin\Phile\PhpFastCache\PhileToPsr16CacheAdapter::class,
39
            $cache
40
        );
41
    }
42
43 1
    public function testCreateCacheCustom()
44
    {
45 1
        $customConfig = new \Phpfastcache\Drivers\Memstatic\Config();
46 1
        $config = new Config([
47
            'plugins' => [
48
                'phile\\phpFastCache' => [
49
                    'active' => true,
50
                    'phpFastCacheConfig' => $customConfig
51
                ]
52
            ]
53
        ]);
54 1
        $this->createPhileCore(null, $config)->bootstrap();
55 1
        $cache = ServiceLocator::getService('Phile_Cache');
56 1
        $this->assertInstanceOf(
57
            \Phile\Plugin\Phile\PhpFastCache\PhileToPsr16CacheAdapter::class,
58
            $cache
59
        );
60
    }
61
}
62