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

testMutatingMethodsReturnBoolean()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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