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');
 }
Esempio n. 2
0
 public function checkTwoFiles(CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run order --no-exit');
     $I->seeFileFound('order.txt', 'tests/_log');
     $I->seeInThisFile("IBSBSBS([BST][BSTF][BST])");
 }
 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'");
 }
Esempio n. 4
0
 public function checkAfterBeforeClassInTests(CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run order BeforeAfterClassTest.php');
     $I->seeFileFound('order.txt', 'tests/_output');
     $I->seeInThisFile('BIB({[1][2])}');
 }
Esempio n. 5
0
 public function bootstrapEmpty(\CliGuy $I)
 {
     $I->executeCommand('bootstrap --empty');
     $I->dontSeeFileFound('tests/acceptance');
     $I->dontSeeFileFound('AcceptanceTester.php', 'tests/acceptance');
     $I->seeFileFound('codeception.yml');
 }
Esempio n. 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 configStartWithoutOption(CliGuy $I)
 {
     $I->wantTo("start first time codeception without options");
     $I->amInPath('tests/data/register_command/');
     $I->executeCommand('');
     $I->seeInShellOutput('Available commands:');
 }
Esempio n. 8
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');
 }
Esempio n. 9
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?");
 }
Esempio n. 11
0
 public function checkCodeceptionTest(CliGuy $I)
 {
     $I->amInPath('tests/data/sandbox');
     $I->executeCommand('run order CodeTest.php --no-exit');
     $I->seeFileFound('order.txt', 'tests/_log');
     $I->expect('global bootstrap, initialization, beforeSuite, beforeClass, bootstrap, before, after, afterSuite, afterClass');
     $I->seeFileContentsEqual("BI({B[C])}");
 }
Esempio n. 12
0
 /**
  * @before moveToIncluded
  * @param CliGuy $I
  */
 public function runIncludedWithCoverage(\CliGuy $I)
 {
     $I->executeCommand('run --coverage-xml');
     $I->amInPath('_log');
     $I->seeFileFound('coverage.xml');
     $I->seeInThisFile('<class name="BillEvans" namespace="Jazz\\Pianist">');
     $I->seeInThisFile('<class name="Musician" namespace="Jazz">');
     $I->seeInThisFile('<class name="Hobbit" namespace="Shire">');
 }
Esempio n. 13
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');
 }
Esempio n. 14
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;');
 }
Esempio n. 15
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;');
 }
Esempio n. 16
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");
 }
Esempio n. 17
0
    public function runWithCustomOuptutPath(\CliGuy $I)
    {
        $I->executeCommand('run dummy --xml myverycustom.xml --html myownhtmlreport.html');
        $I->seeFileFound('myverycustom.xml', 'tests/_log');
        $I->seeInThisFile('<?xml');
        $I->seeInThisFile('<testsuite name="dummy"');
        $I->seeInThisFile('<testcase name="FileExists"');
        $I->seeFileFound('myownhtmlreport.html', 'tests/_log');
        $I->dontSeeFileFound('report.xml','tests/_log');
        $I->dontSeeFileFound('report.html','tests/_log');

    }
<?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!');
Esempio n. 19
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');
Esempio n. 20
0
<?php

$testsPath = __DIR__ . '/../';
$I = new CliGuy($scenario);
$I->wantTo('generate xml reports for unit tests');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('run unit --xml --no-exit');
$I->seeFileFound('report.xml', 'tests/_output');
$I->seeInThisFile('<?xml');
$I->seeInThisFile('<testsuite name="unit"');
$I->seeInThisFile('<testcase name="testMe" class="PassingTest"');
$I->seeInThisFile('<testcase name="testIsTriangle with data set #0" class="DataProvidersTest" ' . 'file="' . realpath($testsPath . '/data/sandbox/tests/unit/DataProvidersTest.php') . '" ');
$I->seeInThisFile('<testcase name="testOne" class="DependsTest"');
$I->seeInThisFile('<failure type="PHPUnit_Framework_ExpectationFailedException">FailingTest::testMe');
<?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');
Esempio n. 22
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('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');
Esempio n. 24
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');
<?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');
    <?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->seeFileFound('HouseHelper.php', 'tests/_helpers');
$I->seeFileFound('_bootstrap.php', 'tests/house');
Esempio n. 27
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
);
    }
<?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');
Esempio n. 29
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->dontSeeInShellOutput("======> Entering NoGroup Test Scope\nMake it incomplete");
$I->dontSeeInShellOutput('<====== Ending NoGroup Test Scope');
$I->executeCommand('run dummy -g ok -c codeception_grouped.yml');
$I->dontSeeInShellOutput("======> Entering Ok Test Scope\nMake it incomplete");
$I->dontSeeInShellOutput('<====== Ending Ok Test Scope');
<?php

$I = new CliGuy($scenario);
$I->wantTo('generate scenarios сценарий');
$I->amInPath('tests/data/sandbox');
$I->executeCommand('generate:scenarios dummy');
$I->seeFileFound('File_Exists.txt', 'tests/_data/scenarios');
$I->seeFileContentsEqual(<<<EOF
I WANT TO CHECK CONFIG EXISTS

I see file found "codeception.yml"
EOF
);