public function checkEnvParamsPassed(CliGuy $I)
 {
     $I->amInPath('tests/data/params');
     $I->executeCommand('run --no-exit');
     $I->seeInShellOutput('FAILURES');
     $I->seeInShellOutput("Failed asserting that an array contains 'val1'");
 }
Пример #2
0
 public function snippetsScenarioFolder(CliGuy $I)
 {
     $I->executeCommand('gherkin:snippets scenario subfolder');
     $I->seeInShellOutput('Given I have a feature in a subfolder');
     $I->seeInShellOutput('public function iHaveAFeatureInASubfolder');
     $I->dontSeeInShellOutput('@Given I have only idea of what\'s going on here');
     $I->dontSeeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
 }
 public function startMyCommandWithOptionAndConfigurationAtNewPlace(CliGuy $I)
 {
     $myname = get_current_user();
     $I->amInPath('tests/data/register_command');
     $I->executeCommand('myProject:myCommand --config standard/codeception.yml --friendly');
     $I->seeInShellOutput("Hello {$myname},");
     $I->seeInShellOutput("how are you?");
 }
Пример #4
0
 /**
  * @before moveToIncluded
  * @param CliGuy $I
  */
 public function buildIncluded(\CliGuy $I)
 {
     $I->executeCommand('build');
     $I->seeInShellOutput('generated successfully');
     $I->seeInShellOutput('Jazz\\TestGuy');
     $I->seeInShellOutput('Jazz\\Pianist\\TestGuy');
     $I->seeInShellOutput('Shire\\TestGuy');
 }
 public function checkIfExtensionsReceiveCorrectOptions(CliGuy $I)
 {
     $I->wantTo('check if extensions receive correct options');
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run tests/dummy/AnotherCest.php:optimistic -c codeception_extended.yml');
     $I->seeInShellOutput('Low verbosity');
     $I->executeCommand('run tests/dummy/AnotherCest.php:optimistic -c codeception_extended.yml -v');
     $I->seeInShellOutput('Medium verbosity');
     $I->executeCommand('run tests/dummy/AnotherCest.php:optimistic -c codeception_extended.yml -vv');
     $I->seeInShellOutput('High verbosity');
     $I->executeCommand('run tests/dummy/AnotherCest.php:optimistic -c codeception_extended.yml -vvv');
     $I->seeInShellOutput('Extreme verbosity');
 }
Пример #6
0
 public function runOneGroup(\CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run skipped -g notorun');
     $I->seeInShellOutput("Incomplete");
     $I->dontSeeInShellOutput("Skipped");
 }
 public function configStartWithWrongPath(CliGuy $I)
 {
     $I->wantTo('start codeception with wrong path to a codeception.yml file');
     $I->amInPath('tests/data/register_command/');
     $I->executeFailCommand('-c no/exists/codeception.yml');
     $I->seeInShellOutput('Your configuration file `no/exists/codeception.yml` could not be found.');
 }
Пример #8
0
 public function bootstrapCompatibilityWithNamespace(\CliGuy $I)
 {
     $I->executeCommand('bootstrap --namespace Generated --compat');
     $I->seeInShellOutput('Building Actor classes for suites');
     $I->seeFileFound('codeception.yml');
     $I->seeInThisFile('namespace: Generated');
     $I->dontSeeInThisFile('namespace Generated\\');
     $this->checkCompatFilesCreated($I);
     $I->seeFileFound('WebHelper.php');
     $I->seeInThisFile('namespace Generated\\Codeception\\Module;');
     $I->seeFileFound('WebGuy.php');
     $I->seeInThisFile('namespace Generated;');
 }
Пример #9
0
 public function bootstrapWithNamespace(\CliGuy $I)
 {
     $I->executeCommand('bootstrap --namespace Generated');
     $I->seeInShellOutput('Building Actor classes for suites');
     $I->seeFileFound('codeception.yml');
     $I->seeInThisFile('namespace: Generated');
     $I->dontSeeInThisFile('namespace Generated\\');
     $this->checkFilesCreated($I);
     $I->seeFileFound('Acceptance.php', 'tests/_support/Helper');
     $I->seeInThisFile('namespace Generated\\Helper;');
     $I->seeFileFound('AcceptanceTester.php', 'tests/_support');
     $I->seeInThisFile('namespace Generated;');
 }
Пример #10
0
 public function bootstrapWithNamespace(\CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox/tests/_data/');
     $I->executeCommand('bootstrap --namespace Generated');
     $I->seeInShellOutput('Building Guy classes for suites');
     $I->seeFileFound('codeception.yml');
     $I->seeInThisFile('namespace: Generated');
     $I->dontSeeInThisFile('namespace Generated\\');
     $this->checkFilesCreated($I);
     $I->seeFileFound('WebHelper.php');
     $I->seeInThisFile('namespace Generated\\Codeception\\Module;');
     $I->seeFileFound('WebGuy.php');
     $I->seeInThisFile('namespace Generated;');
 }
Пример #11
0
 /**
  * @before moveToIncluded
  * @param CliGuy $I
  */
 public function runSuitesFromIncludedConfigs(\CliGuy $I)
 {
     $I->executeCommand('run');
     $I->seeInShellOutput('[Jazz]');
     $I->seeInShellOutput('Jazz.functional Tests');
     $I->seeInShellOutput('[Jazz\\Pianist]');
     $I->seeInShellOutput('Jazz\\Pianist.functional Tests');
     $I->seeInShellOutput('[Shire]');
     $I->seeInShellOutput('Shire.functional Tests');
 }
Пример #12
0
 public function runFeature(CliGuy $I)
 {
     $I->executeCommand('dry-run scenario File.feature --no-ansi');
     $I->seeInShellOutput('Run gherkin: Check file exists');
     $I->seeInShellOutput('In order to test a feature');
     $I->seeInShellOutput('As a user');
     $I->seeInShellOutput('Given i have terminal opened');
     $I->seeInShellOutput('INCOMPLETE');
     $I->seeInShellOutput('Step definition for `I have only idea of what\'s going on here` not found');
 }
Пример #13
0
 protected function checkAllSuitesExecuted(\CliGuy $I)
 {
     $I->seeInShellOutput('[ToastPack]');
     $I->seeInShellOutput('ToastPack.unit Tests');
     $I->seeInShellOutput('[EwokPack]');
     $I->seeInShellOutput('EwokPack.unit Tests');
     $I->seeInShellOutput('[AcmePack]');
     $I->seeInShellOutput('AcmePack.unit Tests');
     $I->dontSeeInShellOutput('[Spam]');
     $I->dontSeeInShellOutput('[SpamPack]');
 }
Пример #14
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('see that comments can be easily added to test');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run tests/skipped/CommentsCept.php --steps');
$I->seeInShellOutput('* As a very lazy qa');
$I->seeInShellOutput('* So that I not do anything at all');
$I->seeInShellOutput('* have a comment for you');
$I->seeInShellOutput('* but I am too lazy to do any job');
$I->seeInShellOutput('* so please do that yourself');
$I->seeInShellOutput('I am going to leave that to you');
$I->seeInShellOutput('I expect you forgive me');
<?php

$I = new CliGuy($scenario);
$I->am('developer who likes testing');
$I->wantTo('generate sample Suite');
$I->lookForwardTo('have a better tests categorization');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('generate:suite house HouseGuy');
$I->seeFileFound('house.suite.yml', 'tests');
$I->expect('guy class is generated');
$I->seeInThisFile('class_name: HouseGuy');
$I->seeInThisFile('- \\Helper\\House');
$I->seeFileFound('House.php', 'tests/_support/Helper');
$I->seeInThisFile('namespace Helper;');
$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');
Пример #16
0
 public function environmentsFromSubfolders(CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run messages MessageCest.php:allMessages -vv --env env3');
     $I->seeInShellOutput('MESSAGE2 FROM ENV3');
 }
<?php

$I = new CliGuy($scenario);
$I->wantTo('generate gherkin steps');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('generate:feature scenario Login');
$I->seeInShellOutput('Feature was created');
$I->seeFileFound('Login.feature', 'tests/scenario');
$I->seeInThisFile('Feature: Login');
$I->deleteThisFile();
$I->executeCommand('generate:feature scenario dummy/Login');
$I->seeFileFound('Login.feature', 'tests/scenario/dummy');
$I->seeInThisFile('Feature: Login');
Пример #18
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('change configs and check that Guy is rebuilt');
$I->amInPath('tests/data/sandbox');
$I->writeToFile('tests/unit.suite.yml', <<<EOF
class_name: CodeGuy
modules:
    enabled: [Cli, CodeHelper]
EOF
);
$I->executeCommand('run unit PassingTest.php --debug');
$I->seeInShellOutput('Cli');
$I->seeFileFound('tests/_support/_generated/CodeGuyActions.php');
$I->seeInThisFile('public function seeInShellOutput');
$I->seeInThisFile('public function runShellCommand');
Пример #19
0
    /**
     * @before skipIfNoXdebug
     * @param CliGuy $I
     */
    public function runTestWithSubSteps(\CliGuy $I)
    {
        $file = "codeception" . DIRECTORY_SEPARATOR . "c3";
        $I->executeCommand('run scenario SubStepsCept --steps');
        $I->seeInShellOutput(<<<EOF
Scenario:
* I am in path "."
* I see code coverage files are present
  I see file found "c3.php"
  I see file found "composer.json"
  I see in this file "{$file}"
EOF
);
    }
Пример #20
0
<?php

$I = new CliGuy($scenario);
$I->wantToTest('build command');
$I->runShellCommmand('php codecept build');
$I->seeInShellOutput('generated sucessfully');
$I->seeFileFound('TestGuy.php', 'tests/functional');
$I->seeFileFound('CodeGuy.php', 'tests/unit');
$I->seeFileFound('CliGuy.php', 'tests/acceptance');
$I->seeInThisFile('seeFileFound(');
Пример #21
0
 public function runDependentTest(CliGuy $I)
 {
     $I->executeCommand('run unit DependsTest --no-exit');
     $I->seeInShellOutput('Skipped: 1');
     $I->executeCommand('run unit --no-exit');
     $I->seeInShellOutput('Skipped: 2');
 }
Пример #22
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('execute incomplete test');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped IncompleteMeCept.php');
$I->seeShellOutputMatches("~\\(IncompleteMeCept.php\\)\\s*?Incomplete~");
$I->seeInShellOutput('OK, but incomplete or skipped tests!');
Пример #23
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('see that my group events fire only once');
$I->amInPath('tests/data/claypit');
$I->executeCommand('run dummy -g countevents -c codeception_grouped.yml');
$I->seeInShellOutput('Group Before Events: 1');
$I->dontSeeInShellOutput('Group Before Events: 2');
$I->seeInShellOutput('Group After Events: 1');
$I->dontSeeInShellOutput('Group After Events: 2');
Пример #24
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('see that my group extension works');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped -g notorun -c codeception_grouped.yml');
$I->seeInShellOutput("======> Entering NoGroup Test Scope\nTrying to make it incomplete");
$I->seeInShellOutput('<====== Ending NoGroup Test Scope');
<?php

$I = new CliGuy($scenario);
$I->wantTo('execute incomplete test');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped IncompleteMeCept.php');
$I->seeInShellOutput("I IncompleteMeCept: Make it incomplete");
$I->seeInShellOutput('OK, but incomplete, skipped, or risky tests!');
Пример #26
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('run skipped test');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped SkipMeCept.php');
$I->seeShellOutputMatches("~\\(SkipMeCept\\)\\s*?Skipped~");
$I->seeInShellOutput('OK, but incomplete, skipped, or risky tests!');
Пример #27
0
 public function runTestWithFailFast(\CliGuy $I)
 {
     $I->executeCommand('run unit --no-exit');
     $I->seeInShellOutput('Running FailingTest::testMe');
     $I->seeInShellOutput("PassingTest::testMe");
     $I->executeCommand('run unit --fail-fast --no-exit');
     $I->seeInShellOutput('There was 1 failure');
     $I->dontSeeInShellOutput("PassingTest::testMe");
 }
Пример #28
0
<?php

$I = new CliGuy($scenario);
$I->wantTo('perform actions and see result');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run skipped SkipMeCept.php');
$I->seeInShellOutput('(SkipMeCept.php)  SKIPPED');
$I->seeInShellOutput('OK, but incomplete or skipped tests!');
Пример #29
0
 public function runTestWithDataProviders(\CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run tests/unit/DataProvidersTest.php');
     $I->seeInShellOutput('Trying to test is triangle with data set "real triangle" (DataProvidersTest::testIsTriangle)');
     $I->seeInShellOutput('Trying to test is triangle with data set #0 (DataProvidersTest::testIsTriangle)');
     $I->seeInShellOutput('Trying to test is triangle with data set #1 (DataProvidersTest::testIsTriangle)');
     $I->seeInShellOutput("OK");
 }
<?php

$I = new CliGuy($scenario);
$I->wantTo('use alternative formatter delivered through extensions');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run tests/skipped/CommentsCept.php -c codeception_extended.yml');
$I->dontSeeInShellOutput("Trying to talk, just talk");
$I->dontSeeInShellOutput('As a very lazy qa');
$I->seeInShellOutput('[+] talk, just talk');