Completed
Push — master ( a8b991...dda2b8 )
by Marco
06:05 queued 02:56
created

VoidCacheTest   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 49
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testShouldAlwaysReturnFalseOnContains() 0 7 1
A testShouldAlwaysReturnFalseOnFetch() 0 7 1
A testShouldAlwaysReturnTrueOnSaveButNotStoreAnything() 0 9 1
A testShouldAlwaysReturnTrueOnDelete() 0 6 1
A testShouldAlwaysReturnNullOnGetStatus() 0 6 1
A testShouldAlwaysReturnTrueOnFlush() 0 6 1
1
<?php
2
3
namespace Doctrine\Tests\Common\Cache;
4
5
use Doctrine\Common\Cache\VoidCache;
6
7
/**
8
 * @covers \Doctrine\Common\Cache\VoidCache
9
 */
10
class VoidCacheTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testShouldAlwaysReturnFalseOnContains()
13
    {
14
        $cache = new VoidCache();
15
16
        $this->assertFalse($cache->contains('foo'));
17
        $this->assertFalse($cache->contains('bar'));
18
    }
19
20
    public function testShouldAlwaysReturnFalseOnFetch()
21
    {
22
        $cache = new VoidCache();
23
24
        $this->assertFalse($cache->fetch('foo'));
25
        $this->assertFalse($cache->fetch('bar'));
26
    }
27
28
    public function testShouldAlwaysReturnTrueOnSaveButNotStoreAnything()
29
    {
30
        $cache = new VoidCache();
31
32
        $this->assertTrue($cache->save('foo', 'fooVal'));
33
34
        $this->assertFalse($cache->contains('foo'));
35
        $this->assertFalse($cache->fetch('foo'));
36
    }
37
38
    public function testShouldAlwaysReturnTrueOnDelete()
39
    {
40
        $cache = new VoidCache();
41
42
        $this->assertTrue($cache->delete('foo'));
43
    }
44
45
    public function testShouldAlwaysReturnNullOnGetStatus()
46
    {
47
        $cache = new VoidCache();
48
49
        $this->assertNull($cache->getStats());
50
    }
51
52
    public function testShouldAlwaysReturnTrueOnFlush()
53
    {
54
        $cache = new VoidCache();
55
56
        $this->assertTrue($cache->flushAll());
57
    }
58
}
59