Passed
Push — master ( 4c95d5...ad70ef )
by Alexander
01:34
created

ConsoleCest::testCommandUserCreateSuccessCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Tests\Cli;
6
7
use App\Tests\Support\CliTester;
8
use Yiisoft\Yii\Console\ExitCode;
0 ignored issues
show
Bug introduced by
The type Yiisoft\Yii\Console\ExitCode was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
    public function testCommandUserCreateSuccessCommand(CliTester $I): void
34
    {
35
        $command = dirname(__DIR__, 2) . '/yii';
36
        $I->runShellCommand($command . ' user/create user create123456');
37
        $I->seeResultCodeIs(ExitCode::OK);
38
    }
39
    /**
40
     * Clear all data created with testCommandFixtureAdd().
41
     * Clearing database prevents from getting errors during multiple continuous testing with other test,
42
     * what are based on empty database (eg, BlogPageCest).
43
     */
44
    public function testCommandCycleSchemaClear(CliTester $I): void
45
    {
46
        $command = dirname(__DIR__, 2) . '/yii';
47
        $I->runShellCommand($command . ' fixture/schema/clear');
48
        $I->seeResultCodeIs(0);
49
    }
50
}
51