Blame view

vendor/codeception/base/tests/cli/GenerateSuiteCest.php 1.6 KB
2e86c939   xu   “首次提交”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
class GenerateSuiteCest
{
    public function generateSimpleSuite(CliGuy $I)
    {
        $I->amInPath('tests/data/sandbox');
        $I->executeCommand('generate:suite house HouseGuy');
        $I->seeFileFound('house.suite.yml', 'tests');
        $I->expect('actor class is generated');
        $I->seeInThisFile('actor: HouseGuy');
        $I->seeInThisFile('- \Helper\House');
        $I->seeFileFound('House.php', 'tests/_support/Helper');
        $I->seeInThisFile('namespace Helper;');
        $I->seeDirFound('tests/house');
        $I->seeFileFound('_bootstrap.php', 'tests/house');

        $I->expect('suite is not created due to dashes');
        $I->executeCommand('generate:suite invalid-dash-suite');
        $I->seeInShellOutput('contains invalid characters');
    }

    public function generateSuiteWithCustomConfig(CliGuy $I)
    {
        $I->amInPath('tests/data/sandbox');
        $I->executeCommand('bootstrap --empty src/FooBar --namespace FooBar');
        $I->executeCommand('generate:suite house HouseGuy -c src/FooBar');
        $I->seeDirFound('src/FooBar/tests/house');
        $I->seeFileFound('house.suite.yml', 'src/FooBar/tests');
        $I->expect('guy class is generated');
        $I->seeInThisFile('actor: HouseGuy');
        $I->seeInThisFile('- \FooBar\Helper\House');
        $I->seeFileFound('House.php', 'src/FooBar/tests/_support/Helper');
        $I->seeInThisFile('namespace FooBar\Helper;');

        $I->expect('suite is not created due to dashes');
        $I->executeCommand('generate:suite invalid-dash-suite');
        $I->seeInShellOutput('contains invalid characters');
    }
}