PluginTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 25
c 1
b 0
f 0
dl 0
loc 43
ccs 16
cts 16
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testCreateCacheFile() 0 12 1
A testCreateCacheDefault() 0 7 1
A testCreateCacheCustom() 0 16 1
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