Completed
Branch master (1afc22)
by Dan
09:51 queued 07:56
created

NullStorageTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 52
rs 10
c 1
b 0
f 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testHas() 0 3 1
A testSet() 0 3 1
A testGet() 0 3 1
A testDelete() 0 3 1
A testClear() 0 3 1
A setUp() 0 4 1
1
<?php
2
3
namespace Tests\Cache\Storage;
4
5
use Ds\Cache\Storage\NullStorage;
6
7
/**
8
 * Class NullStorageTest
9
 *
10
 * @package Tests\Cache\Storage
11
 */
12
class NullStorageTest extends \PHPUnit\Framework\TestCase
13
{
14
15
    /**
16
     * @var NullStorage
17
     */
18
    public $cacheStorage;
19
20
    /**
21
     *
22
     */
23
    public function setUp()
24
    {
25
        $this->cacheStorage = new NullStorage();
26
    }
27
28
    /**
29
     *
30
     */
31
    public function testHas(){
32
        $this->assertEquals($this->cacheStorage->has('key', 'value'), false);
0 ignored issues
show
Unused Code introduced by
The call to NullStorage::has() has too many arguments starting with 'value'.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
33
    }
34
35
    /**
36
     *
37
     */
38
    public function testSet(){
39
        $this->assertEquals($this->cacheStorage->set('key', 'value', 10), true);
40
    }
41
42
    /**
43
     *
44
     */
45
    public function testGet(){
46
        $this->assertEquals($this->cacheStorage->get('key'), null);
47
    }
48
49
    /**
50
     *
51
     */
52
    public function testDelete(){
53
        $this->assertEquals($this->cacheStorage->delete('key'), true);
54
    }
55
56
    /**
57
     *
58
     */
59
    public function testClear(){
60
        $this->assertEquals($this->cacheStorage->clear(), true);
61
    }
62
    
63
}
64