Blame view

vendor/codeception/base/tests/cli/GeneratePageObjectCest.php 1.4 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
<?php

/**
 * @guy CliGuy\GeneratorSteps
 */
class GeneratePageObjectCest
{
    public function generateGlobalPageObject(CliGuy\GeneratorSteps $I)
    {
        $I->amInPath('tests/data/sandbox');
        $I->executeCommand('generate:page Login');
        $I->seeFileWithGeneratedClass('Login', 'tests/_support/Page');
        $I->seeInThisFile('static $URL = ');
        $I->dontSeeInThisFile('public function __construct(\DumbGuy $I)');
        $I->seeFileFound('tests/_bootstrap.php');
    }

    public function generateSuitePageObject(CliGuy\GeneratorSteps $I)
    {
        $I->amInPath('tests/data/sandbox');
        $I->executeCommand('generate:page dummy Login');
        $I->seeFileWithGeneratedClass('Login', 'tests/_support/Page/Dummy');
        $I->seeInThisFile('namespace Page\\Dummy;');
        $I->seeInThisFile('class Login');
        $I->seeInThisFile('protected $dumbGuy;');
        $I->seeInThisFile('public function __construct(\DumbGuy $I)');
    }

    public function generateGlobalPageObjectInDifferentPath(CliGuy\GeneratorSteps $I)
    {
        $I->executeCommand('generate:page Login -c tests/data/sandbox');
        $I->amInPath('tests/data/sandbox');
        $I->seeFileWithGeneratedClass('Login', 'tests/_support/Page');
        $I->seeInThisFile('static $URL = ');
        $I->dontSeeInThisFile('public function __construct(\DumbGuy $I)');
        $I->seeFileFound('tests/_bootstrap.php');
    }
}