Completed
Push — master ( 17598f...abee1f )
by Kirill
13s queued 11s
created

CompileTest::testResetClean()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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