Passed
Push — main ( 700cae...bce8dd )
by Sílvio
01:08
created

BooleanReturnTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 13
c 3
b 0
f 0
dl 0
loc 26
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testMutatingMethodsReturnBoolean() 0 6 1
A setUp() 0 4 1
A testHasReturnsBoolean() 0 8 1
1
<?php
2
3
use PHPUnit\Framework\TestCase;
4
use Silviooosilva\CacheerPhp\Cacheer;
5
6
class BooleanReturnTest extends TestCase
7
{
8
    private Cacheer $cache;
9
10
    protected function setUp(): void
11
    {
12
        $this->cache = new Cacheer();
13
        $this->cache->setDriver()->useArrayDriver();
14
    }
15
16
    public function testHasReturnsBoolean()
17
    {
18
        $this->cache->putCache('bool_key', 'value');
19
        $this->assertTrue($this->cache->has('bool_key'));
20
        $this->assertTrue($this->cache->isSuccess());
21
22
        $this->assertFalse($this->cache->has('unknown_key'));
23
        $this->assertFalse($this->cache->isSuccess());
24
    }
25
26
    public function testMutatingMethodsReturnBoolean()
27
    {
28
        $this->assertTrue($this->cache->putCache('k', 'v'));
29
        $this->assertTrue($this->cache->flushCache());
30
        $this->assertTrue($this->cache->putCache('k', 'v'));
31
        $this->assertTrue($this->cache->clearCache('k'));
32
    }
33
}
34