NullCacheTest::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php
2
3
namespace SubjectivePHPTest\Psr\SimpleCache;
4
5
use SubjectivePHP\Psr\SimpleCache\NullCache;
6
7
/**
8
 * @coversDefaultClass SubjectivePHP\Psr\SimpleCache\NullCache
9
 * @covers ::<private>
10
 * @covers ::<protected>
11
 */
12
final class NullCacheTest extends \PHPUnit\Framework\TestCase
13
{
14
    /**
15
     * Verify basic behavior of get().
16
     *
17
     * @test
18
     * @covers ::get
19
     *
20
     * @return void
21
     */
22
    public function get()
23
    {
24
        $cache = new NullCache();
25
        $default = new \StdClass();
26
        $this->assertSame($default, $cache->get('a key', $default));
27
    }
28
29
    /**
30
     * Verify basic behavior of set().
31
     *
32
     * @test
33
     * @covers ::set
34
     *
35
     * @return void
36
     */
37
    public function set()
38
    {
39
        $cache = new NullCache();
40
        $this->assertTrue($cache->set('a key', 'some data'));
41
    }
42
43
    /**
44
     * Verify basic behavior of delete().
45
     *
46
     * @test
47
     * @covers ::delete
48
     *
49
     * @return void
50
     */
51
    public function delete()
52
    {
53
        $cache = new NullCache();
54
        $this->assertTrue($cache->delete('a key'));
55
    }
56
57
    /**
58
     * Verify basic behavior of clear().
59
     *
60
     * @test
61
     * @covers ::clear
62
     *
63
     * @return void
64
     */
65
    public function clear()
66
    {
67
        $cache = new NullCache();
68
        $this->assertTrue($cache->clear());
69
    }
70
71
    /**
72
     * Verify basic behavior of getMultple().
73
     *
74
     * @test
75
     * @covers ::getMultiple
76
     *
77
     * @return void
78
     */
79
    public function getMultiple()
80
    {
81
        $cache = new NullCache();
82
        $default = new \StdClass();
83
        $this->assertSame(
84
            ['key1' => $default, 'key2' => $default],
85
            $cache->getMultiple(['key1', 'key2'], $default)
86
        );
87
    }
88
89
    /**
90
     * Verify basic behavior of setMultiple().
91
     *
92
     * @test
93
     * @covers ::setMultiple
94
     *
95
     * @return void
96
     */
97
    public function setMultiple()
98
    {
99
        $cache = new NullCache();
100
        $this->assertTrue($cache->setMultiple(['key' => 'some data', 'key2' => 'some more data']));
101
    }
102
103
    /**
104
     * Verify basic behavior of deleteMultiple().
105
     *
106
     * @test
107
     * @covers ::deleteMultiple
108
     *
109
     * @return void
110
     */
111
    public function deleteMultiple()
112
    {
113
        $cache = new NullCache();
114
        $this->assertTrue($cache->deleteMultiple(['key1', 'key2']));
115
    }
116
117
    /**
118
     * Verify basic behavior of has().
119
     *
120
     * @test
121
     * @covers ::has
122
     *
123
     * @return void
124
     */
125
    public function has()
126
    {
127
        $cache = new NullCache();
128
        $this->assertFalse($cache->has('key1'));
129
    }
130
}
131