|
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
|
|
|
|