CacheTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 24
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testCaching() 0 10 1
A testCalls() 0 7 1
1
<?php
2
3
namespace Spiral\Tests\PhpFastCache;
4
5
use Psr\SimpleCache\CacheInterface;
6
use Spiral\PhpFastCache\CacheBootloader;
7
use Spiral\Tests\BaseTest;
8
9
/**
10
 * Class CacheTest
11
 *
12
 * @package Spiral\Tests\PhpFastCache
13
 * @property CacheInterface $cache
14
 */
15
class CacheTest extends BaseTest
16
{
17
    const NAME  = 'some-name';
18
    const VALUE = 'some-value';
19
20
    public function testCaching()
21
    {
22
        $this->app->getBootloader()->bootload([CacheBootloader::class]);
23
        $this->cache->set(self::NAME, self::VALUE);
24
25
        $default = 'some-default';
26
        $this->assertEquals($default, $this->cache->get('some-other-key', $default));
27
28
        $this->assertEquals(self::VALUE, $this->cache->get(self::NAME));
29
    }
30
31
    public function testCalls()
32
    {
33
        $this->app->getBootloader()->bootload([CacheBootloader::class]);
34
        $this->app->callAction(CacheController::class, 'set');
35
36
        $this->assertEquals(self::VALUE, $this->app->callAction(CacheController::class, 'get'));
37
    }
38
}