Passed
Push — master ( c21d64...956340 )
by Arthur
05:06
created

BootstrappingTest::testCacheDelete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 03.10.18
6
 * Time: 22:58.
7
 */
8
9
namespace Foundation\Tests;
10
11
use Foundation\Services\BootstrapRegistrarService;
12
use Tests\TestCase;
13
14
class BootstrappingTest extends TestCase
15
{
16
    protected $service;
17
18
    public function __construct(?string $name = null, array $data = [], string $dataName = '')
19
    {
20
        parent::__construct($name, $data, $dataName);
21
        $this->service = new BootstrapRegistrarService();
22
    }
23
24
25 1
    public function testCacheDelete()
26
    {
27 1
        $this->assertTrue($this->service->cacheExists());
28 1
        $this->service->clearCache();
29 1
        $this->assertFalse($this->service->cacheExists());
30 1
    }
31
32 1
    public function testCaching()
33
    {
34 1
        if ($this->service->cacheExists()) {
35 1
            $this->service->clearCache();
36
        }
37 1
        $this->assertFalse($this->service->cacheExists());
38 1
        $this->service->recache();
39 1
        $this->assertTrue($this->service->cacheExists());
40 1
    }
41
42
    public function readContentsCache()
43
    {
44
        $bootstrapData = $this->service->loadBootstrapFromCache();
45
        $this->assertArrayHasKey('commands', $bootstrapData);
46
        $this->assertArrayHasKey('routes', $bootstrapData);
47
        $this->assertArrayHasKey('configs', $bootstrapData);
48
        $this->assertArrayHasKey('factories', $bootstrapData);
49
        $this->assertArrayHasKey('migrations', $bootstrapData);
50
        $this->assertArrayHasKey('seeders', $bootstrapData);
51
    }
52
}
53