1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Spiral Framework. |
5
|
|
|
* |
6
|
|
|
* @license MIT |
7
|
|
|
* @author Anton Titov (Wolfy-J) |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
declare(strict_types=1); |
11
|
|
|
|
12
|
|
|
namespace Spiral\Tests\Framework\Views; |
13
|
|
|
|
14
|
|
|
use Spiral\Boot\DirectoriesInterface; |
15
|
|
|
use Spiral\Files\FilesInterface; |
16
|
|
|
use Spiral\Tests\Framework\ConsoleTest; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @covers \Spiral\Command\Views\ResetCommand |
20
|
|
|
* @covers \Spiral\Command\Views\CompileCommand |
21
|
|
|
*/ |
22
|
|
|
class CompileTest extends ConsoleTest |
23
|
|
|
{ |
24
|
|
|
public function testCompile(): void |
25
|
|
|
{ |
26
|
|
|
$out = $this->runCommandDebug('views:compile'); |
27
|
|
|
$this->assertStringContainsString('default:custom/file', $out); |
28
|
|
|
|
29
|
|
|
$this->assertStringContainsString('custom:error', $out); |
30
|
|
|
$this->assertStringContainsString('Unable to compile custom:error', $out); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function testReset(): void |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* @var DirectoriesInterface $dirs |
37
|
|
|
* @var FilesInterface $fs |
38
|
|
|
*/ |
39
|
|
|
$dirs = $this->app->get(DirectoriesInterface::class); |
40
|
|
|
$fs = $this->app->get(FilesInterface::class); |
41
|
|
|
$fs->write($dirs->get('cache') . '/views/test.php', 'test', null, true); |
42
|
|
|
|
43
|
|
|
$out = $this->runCommandDebug('views:reset'); |
44
|
|
|
$this->assertStringContainsString('test.php', $out); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function testResetClean(): void |
48
|
|
|
{ |
49
|
|
|
$out = $this->runCommandDebug('views:reset'); |
50
|
|
|
$this->assertStringContainsString('no cache', $out); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function testClean(): void |
54
|
|
|
{ |
55
|
|
|
$this->runCommandDebug('i18n:index'); |
56
|
|
|
|
57
|
|
|
$out = $this->runCommandDebug('cache:clean'); |
58
|
|
|
$this->assertStringContainsString('i18n.en', $out); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|