CacheTest::testCaching()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
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
}