Passed
Branch update-yii-dataview (d90e66)
by Wilmer
13:07
created

ConsoleCest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
eloc 13
c 2
b 0
f 0
dl 0
loc 35
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testCommandFixtureAdd() 0 5 1
A testCommandCycleSchemaClear() 0 5 1
A testCommandListCommand() 0 5 1
A testCommandYii() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Cli;
6
7
use App\Tests\CliTester;
8
use Yiisoft\Yii\Console\ExitCode;
9
10
final class ConsoleCest
11
{
12
    public function testCommandYii(CliTester $I): void
13
    {
14
        $command = dirname(__DIR__, 2) . '/yii';
15
        $I->runShellCommand($command);
16
        $I->seeInShellOutput('Yii Console');
17
    }
18
19
    public function testCommandFixtureAdd(CliTester $I): void
20
    {
21
        $command = dirname(__DIR__, 2) . '/yii';
22
        $I->runShellCommand($command . ' fixture/add');
23
        $I->seeResultCodeIs(ExitCode::OK);
24
    }
25
26
    public function testCommandListCommand(CliTester $I): void
27
    {
28
        $command = dirname(__DIR__, 2) . '/yii';
29
        $I->runShellCommand($command . ' list');
30
        $I->seeResultCodeIs(ExitCode::OK);
31
    }
32
33
    /**
34
     * Clear all data created with testCommandFixtureAdd().
35
     * Clearing database prevents from getting errors during multiple continuous testing with other test,
36
     * what are based on empty database (eg, BlogPageCest)
37
     *
38
     * @param \App\Tests\CliTester $I
39
     */
40
    public function testCommandCycleSchemaClear(CliTester $I): void
41
    {
42
        $command = dirname(__DIR__, 2) . '/yii';
43
        $I->runShellCommand($command . ' fixture/schema/clear');
44
        $I->seeResultCodeIs(0);
45
    }
46
}
47