init
This commit is contained in:
15
vendor/codeception/base/tests/cli/AutoRebuildCept.php
vendored
Normal file
15
vendor/codeception/base/tests/cli/AutoRebuildCept.php
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
<?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');
|
||||
82
vendor/codeception/base/tests/cli/BootstrapCest.php
vendored
Normal file
82
vendor/codeception/base/tests/cli/BootstrapCest.php
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
class BootstrapCest
|
||||
{
|
||||
|
||||
protected $bootstrapPath;
|
||||
|
||||
public function _before(\CliGuy $I)
|
||||
{
|
||||
$this->bootstrapPath = 'tests/data/sandbox/boot'.uniqid();
|
||||
@mkdir($this->bootstrapPath, 0777, true);
|
||||
$I->amInPath($this->bootstrapPath);
|
||||
}
|
||||
|
||||
public function bootstrap(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('bootstrap');
|
||||
$I->seeFileFound('codeception.yml');
|
||||
$this->checkFilesCreated($I);
|
||||
}
|
||||
|
||||
public function bootstrapWithNamespace(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('bootstrap --namespace Generated');
|
||||
|
||||
$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;');
|
||||
}
|
||||
|
||||
public function bootstrapWithActor(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('bootstrap --actor Ninja');
|
||||
$I->seeFileFound('AcceptanceNinja.php', 'tests/_support/');
|
||||
}
|
||||
|
||||
|
||||
public function bootstrapEmpty(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('bootstrap --empty');
|
||||
$I->dontSeeFileFound('tests/acceptance');
|
||||
$I->seeFileFound('codeception.yml');
|
||||
}
|
||||
|
||||
public function bootstrapFromInit(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('init bootstrap');
|
||||
$this->checkFilesCreated($I);
|
||||
}
|
||||
|
||||
public function bootstrapFromInitUsingClassName(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('init "Codeception\Template\Bootstrap"');
|
||||
$this->checkFilesCreated($I);
|
||||
}
|
||||
|
||||
protected function checkFilesCreated(\CliGuy $I)
|
||||
{
|
||||
$I->seeDirFound('tests/_support');
|
||||
$I->seeDirFound('tests/_data');
|
||||
$I->seeDirFound('tests/_output');
|
||||
|
||||
$I->seeFileFound('functional.suite.yml', 'tests');
|
||||
$I->seeFileFound('acceptance.suite.yml', 'tests');
|
||||
$I->seeFileFound('unit.suite.yml', 'tests');
|
||||
|
||||
$I->seeFileFound('AcceptanceTester.php', 'tests/_support');
|
||||
$I->seeFileFound('FunctionalTester.php', 'tests/_support');
|
||||
$I->seeFileFound('UnitTester.php', 'tests/_support');
|
||||
|
||||
$I->seeFileFound('Acceptance.php', 'tests/_support/Helper');
|
||||
$I->seeFileFound('Functional.php', 'tests/_support/Helper');
|
||||
$I->seeFileFound('Unit.php', 'tests/_support/Helper');
|
||||
}
|
||||
|
||||
}
|
||||
13
vendor/codeception/base/tests/cli/BuildCept.php
vendored
Normal file
13
vendor/codeception/base/tests/cli/BuildCept.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
// @group core
|
||||
|
||||
$I = new CliGuy($scenario);
|
||||
$I->wantToTest('build command');
|
||||
$I->runShellCommand('php codecept build');
|
||||
$I->seeInShellOutput('generated successfully');
|
||||
$I->seeInSupportDir('CodeGuy.php');
|
||||
$I->seeInSupportDir('CliGuy.php');
|
||||
$I->seeInThisFile('class CliGuy extends \Codeception\Actor');
|
||||
$I->seeInThisFile('use _generated\CliGuyActions');
|
||||
$I->seeFileFound('CliGuyActions.php', 'tests/support/_generated');
|
||||
$I->seeInThisFile('seeFileFound(');
|
||||
16
vendor/codeception/base/tests/cli/CodeceptionYmlInTestsDirCest.php
vendored
Normal file
16
vendor/codeception/base/tests/cli/CodeceptionYmlInTestsDirCest.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
class CodeceptionYmlInTestsDirCest
|
||||
{
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestPath(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/codeception_yml_in_tests_dir');
|
||||
$I->executeCommand('run unit/ExampleCest.php');
|
||||
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->dontSeeInShellOutput('RuntimeException');
|
||||
$I->dontSeeInShellOutput('could not be found');
|
||||
}
|
||||
}
|
||||
36
vendor/codeception/base/tests/cli/ConfigBundledSuitesCest.php
vendored
Normal file
36
vendor/codeception/base/tests/cli/ConfigBundledSuitesCest.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class ConfigBundledSuitesCest
|
||||
{
|
||||
public function runBundledSuite(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/bundled_suites');
|
||||
$I->executeCommand('build');
|
||||
$I->executeCommand('run -vvv');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
public function runTestByPath(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/bundled_suites');
|
||||
$I->executeCommand('run BasicTest.php');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
public function generateTestsForBundledSuite(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/bundled_suites');
|
||||
$I->executeFailCommand('generate:cept unit Some');
|
||||
$I->seeFileFound('SomeCept.php', '.');
|
||||
$I->deleteFile('SomeCept.php');
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->executeFailCommand('generate:cest unit Some');
|
||||
$I->seeFileFound('SomeCest.php', '.');
|
||||
$I->deleteFile('SomeCest.php');
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->executeFailCommand('generate:test unit Some');
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->seeFileFound('SomeTest.php', '.');
|
||||
$I->deleteFile('SomeTest.php');
|
||||
}
|
||||
}
|
||||
17
vendor/codeception/base/tests/cli/ConfigExtendsCest.php
vendored
Normal file
17
vendor/codeception/base/tests/cli/ConfigExtendsCest.php
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class ConfigExtendsCest
|
||||
{
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedSuites(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/config_extends');
|
||||
$I->executeCommand('run');
|
||||
|
||||
$I->seeInShellOutput('UnitCest');
|
||||
$I->seeInShellOutput('OK (1 test, 1 assertion)');
|
||||
$I->dontSeeInShellOutput('Exception');
|
||||
}
|
||||
}
|
||||
41
vendor/codeception/base/tests/cli/ConfigNoActorCest.php
vendored
Normal file
41
vendor/codeception/base/tests/cli/ConfigNoActorCest.php
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @depends ConfigBundledSuitesCest:runBundledSuite
|
||||
*/
|
||||
class ConfigNoActorCest
|
||||
{
|
||||
/**
|
||||
* @depends ConfigBundledSuitesCest:runBundledSuite
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runSuitesWithoutActor(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/no_actor_suites');
|
||||
$I->executeCommand('run -vvv');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
public function suitesWithoutActorDontHaveActorFiles(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/no_actor_suites');
|
||||
$I->executeCommand('build');
|
||||
$I->dontSeeFileFound('*.php', 'tests/_support');
|
||||
}
|
||||
|
||||
public function suitesWithoutActorGenerators(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/no_actor_suites');
|
||||
$I->executeFailCommand('generate:cept unit Some');
|
||||
$I->seeResultCodeIsNot(0);
|
||||
$I->executeFailCommand('generate:cest unit Some');
|
||||
$I->seeResultCodeIsNot(0);
|
||||
$I->executeFailCommand('generate:test unit Some');
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->seeFileFound('SomeTest.php', 'tests');
|
||||
$I->seeInThisFile('class SomeTest extends \Codeception\Test\Unit');
|
||||
$I->dontSeeInThisFile('$tester');
|
||||
$I->deleteFile('tests/SomeTest.php');
|
||||
}
|
||||
|
||||
}
|
||||
40
vendor/codeception/base/tests/cli/ConfigParamsCest.php
vendored
Normal file
40
vendor/codeception/base/tests/cli/ConfigParamsCest.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
class ConfigParamsCest
|
||||
{
|
||||
public function checkYamlParamsPassed(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/params');
|
||||
$I->executeCommand('run -c codeception_yaml.yml');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
public function checkDotEnvParamsPassed(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/params');
|
||||
$I->executeCommand('run -c codeception_dotenv.yml');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
public function checkComplexDotEnvParamsPassed(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/params');
|
||||
$I->executeCommand('run -c codeception_dotenv2.yml');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
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'");
|
||||
}
|
||||
|
||||
public function checkParamsPassedInSelf(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/params');
|
||||
$I->executeCommand('run -c codeception_self.yml');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
}
|
||||
38
vendor/codeception/base/tests/cli/ConfigValidateCest.php
vendored
Normal file
38
vendor/codeception/base/tests/cli/ConfigValidateCest.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
class ConfigValidateCest
|
||||
{
|
||||
public function _before(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
}
|
||||
|
||||
public function printsValidConfig(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('config:validate --no-ansi', false);
|
||||
$I->dontSeeInShellOutput('ConfigurationException');
|
||||
$I->seeInShellOutput('tests => tests');
|
||||
$I->seeInShellOutput('data => tests/_data');
|
||||
}
|
||||
|
||||
public function validatesInvalidConfigOnParse(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('config:validate -c codeception_invalid.yml --no-ansi', false);
|
||||
$I->seeInShellOutput('Unable to parse at line 8');
|
||||
$I->seeInShellOutput('codeception_invalid.yml');
|
||||
}
|
||||
|
||||
public function validatesInvalidConfigBeforeRun(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('config:validate -c codeception_invalid.yml --no-ansi', false);
|
||||
$I->seeInShellOutput('Unable to parse at line 8');
|
||||
$I->seeInShellOutput('codeception_invalid.yml');
|
||||
}
|
||||
|
||||
public function validatesConfigWithOverrideOption(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('config:validate -o "reporters: report: \Custom\Reporter" --no-ansi');
|
||||
$I->seeInShellOutput('report => \Custom\Reporter');
|
||||
}
|
||||
|
||||
}
|
||||
12
vendor/codeception/base/tests/cli/ConfigWithPresetsCest.php
vendored
Normal file
12
vendor/codeception/base/tests/cli/ConfigWithPresetsCest.php
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class ConfigWithPresetsCest
|
||||
{
|
||||
public function loadWithPresets(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/presets');
|
||||
$I->executeCommand('run -c codeception.yml');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
}
|
||||
|
||||
}
|
||||
170
vendor/codeception/base/tests/cli/DataProviderFailuresAndExceptionsCest.php
vendored
Normal file
170
vendor/codeception/base/tests/cli/DataProviderFailuresAndExceptionsCest.php
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
class DataProviderFailuresAndExceptionsCest
|
||||
{
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
protected function moveToPath(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/dataprovider_failures_and_exceptions');
|
||||
}
|
||||
|
||||
/**
|
||||
* This looks at only the contents of stdout when there is a failure in parsing a dataProvider annotation.
|
||||
* When there is a failure all the useful information should go to stderr, so stdout is left with
|
||||
* only the version headers.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersFailureStdout(\CliGuy $I)
|
||||
{
|
||||
/**
|
||||
* On windows /dev/null is NUL so detect running OS and return the appropriate string for redirection.
|
||||
* As some systems have php_uname and co disabled, we use the DIRECTORY_SEPARATOR constant to
|
||||
* figure out if we are running on windows or not.
|
||||
*/
|
||||
$devNull = (DIRECTORY_SEPARATOR === '\\')?'NUL':'/dev/null';
|
||||
$I->executeCommand('run -n -v unit DataProvidersFailureCest 2> '.$devNull,false);
|
||||
// We should only see the version headers in stdout when there is this kind of failure.
|
||||
$I->canSeeShellOutputMatches('/^Codeception PHP Testing Framework v[0-9\.]+\nPowered by PHPUnit .+ by Sebastian Bergmann and contributors\.$/');
|
||||
$I->seeResultCodeIs(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This redirects stderr to stdout so that we can test the contents of stderr. Stderr is where all the interesting
|
||||
* information should be when there is a failure.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersFailureStderr(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -n unit DataProvidersFailureCest 2>&1',false);
|
||||
$I->seeInShellOutput('Couldn\'t parse test');
|
||||
$I->seeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle');
|
||||
$I->seeInShellOutput('Make sure that the dataprovider exist within the test class.');
|
||||
// For Unit tests PHPUnit throws the errors, this confirms that we haven't ended up running PHPUnit test Loader
|
||||
$I->dontSeeInShellOutput('PHPUnit_Framework_Warning');
|
||||
$I->dontSeeInShellOutput('The data provider specified for DataProvidersFailureCest::testIsTriangle');
|
||||
$I->dontSeeInShellOutput('Method rectangle does not exist');
|
||||
$I->dontSeeInShellOutput('FAILURES!');
|
||||
$I->dontSeeInShellOutput('WARNINGS!');
|
||||
$I->dontSeeInShellOutput('OK');
|
||||
$I->dontSeeInShellOutput('Tests: 1, Assertions: 0, Warnings: 1.');
|
||||
// In normal mode the Exception trace should not appear.
|
||||
$I->dontSeeInShellOutput('Exception trace');
|
||||
$I->seeResultCodeIs(1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This adds the -v to the stderr test which should just add the Exception Trace to the output.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersFailureStderrVerbose(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -n unit DataProvidersFailureCest -v 2>&1',false);
|
||||
$I->seeInShellOutput('Couldn\'t parse test');
|
||||
$I->seeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle');
|
||||
$I->seeInShellOutput('Make sure that the dataprovider exist within the test class.');
|
||||
// For Unit tests PHPUnit throws the errors, this confirms that we haven't ended up running PHPUnit test Loader
|
||||
$I->dontSeeInShellOutput('PHPUnit_Framework_Warning');
|
||||
$I->dontSeeInShellOutput('The data provider specified for DataProvidersFailureCest::testIsTriangle');
|
||||
$I->dontSeeInShellOutput('Method rectangle does not exist');
|
||||
$I->dontSeeInShellOutput('FAILURES!');
|
||||
$I->dontSeeInShellOutput('WARNINGS!');
|
||||
$I->dontSeeInShellOutput('OK');
|
||||
$I->dontSeeInShellOutput('Tests: 1, Assertions: 0, Warnings: 1.');
|
||||
// In verbose mode the Exception trace should be output.
|
||||
$I->seeInShellOutput('[Codeception\Exception\TestParseException]');
|
||||
$I->seeInShellOutput('Exception trace');
|
||||
$I->seeResultCodeIs(1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This looks at only the contents of stdout when there is an exception thrown when executing a dataProvider
|
||||
* function.
|
||||
* When exception thrown all the useful information should go to stderr, so stdout is left with nothing.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersExceptionStdout(\CliGuy $I)
|
||||
{
|
||||
/**
|
||||
* On windows /dev/null is NUL so detect running OS and return the appropriate string for redirection.
|
||||
* As some systems have php_uname and co disabled, we use the DIRECTORY_SEPARATOR constant to
|
||||
* figure out if we are running on windows or not.
|
||||
*/
|
||||
$devNull = (DIRECTORY_SEPARATOR === '\\')?'NUL':'/dev/null';
|
||||
$I->executeCommand('run -n unit DataProvidersExceptionCest -v 2> '.$devNull, false);
|
||||
// Depending on the test environment, we either see nothing or just the headers here.
|
||||
$I->canSeeShellOutputMatches('/^Codeception PHP Testing Framework v[0-9\.]+\nPowered by PHPUnit .+ by Sebastian Bergmann and contributors\.$/');
|
||||
$I->seeResultCodeIs(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* This redirects stderr to stdout so that we can test the contents of stderr. Stderr is where all the interesting
|
||||
* information should be when there is a failure.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersExceptionStderr(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -n unit DataProvidersExceptionCest 2>&1', false);
|
||||
// For Unit tests PHPUnit throws the errors, this confirms that we haven't ended up running PHPUnit test Loader
|
||||
$I->dontSeeInShellOutput('There was 1 warning');
|
||||
$I->dontSeeInShellOutput('PHPUnit_Framework_Warning');
|
||||
$I->dontSeeInShellOutput('The data provider specified for DataProvidersExceptionTest::testIsTriangle');
|
||||
$I->dontSeeInShellOutput('FAILURES!');
|
||||
$I->dontSeeInShellOutput('WARNINGS!');
|
||||
$I->dontSeeInShellOutput('OK');
|
||||
// We should not see the messages related to a failure to parse the dataProvider function
|
||||
$I->dontSeeInShellOutput('[Codeception\Exception\TestParseException]');
|
||||
$I->dontSeeInShellOutput('Couldn\'t parse test');
|
||||
$I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle ');
|
||||
|
||||
// We should just see the message
|
||||
$I->seeInShellOutput('Something went wrong!!!');
|
||||
// We don't have the verbose flag set, so there should be no trace.
|
||||
$I->dontSeeInShellOutput('Exception trace:');
|
||||
$I->seeResultCodeIs(1);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This adds the -v to the stderr test which should just add the Exception Trace to the output of stderr.
|
||||
*
|
||||
* @param CliGuy $I
|
||||
* @before moveToPath
|
||||
*/
|
||||
public function runTestWithDataProvidersExceptionStderrVerbose(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -n unit DataProvidersExceptionCest -v 2>&1', false);
|
||||
// For Unit tests PHPUnit throws the errors, this confirms that we haven't ended up running PHPUnit test Loader
|
||||
$I->dontSeeInShellOutput('There was 1 warning');
|
||||
$I->dontSeeInShellOutput('PHPUnit_Framework_Warning');
|
||||
$I->dontSeeInShellOutput('The data provider specified for DataProvidersExceptionTest::testIsTriangle');
|
||||
$I->dontSeeInShellOutput('FAILURES!');
|
||||
$I->dontSeeInShellOutput('WARNINGS!');
|
||||
$I->dontSeeInShellOutput('OK');
|
||||
// We should not see the messages related to a failure to parse the dataProvider function
|
||||
$I->dontSeeInShellOutput('[Codeception\Exception\TestParseException]');
|
||||
$I->dontSeeInShellOutput('Couldn\'t parse test');
|
||||
$I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle is ');
|
||||
|
||||
// We should just see the message
|
||||
$I->seeInShellOutput('Something went wrong!!!');
|
||||
// We have the verbose flag set, so there should be a trace.
|
||||
$I->seeInShellOutput('[Exception]');
|
||||
$I->seeInShellOutput('Exception trace:');
|
||||
$I->seeResultCodeIs(1);
|
||||
}
|
||||
}
|
||||
25
vendor/codeception/base/tests/cli/DryRunCest.php
vendored
Normal file
25
vendor/codeception/base/tests/cli/DryRunCest.php
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
class DryRunCest
|
||||
{
|
||||
public function _before(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
}
|
||||
|
||||
public function runCestWithExamples(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('dry-run scenario ExamplesCest --no-ansi');
|
||||
$I->seeInShellOutput('ExamplesCest: Files exists annotation');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
14
vendor/codeception/base/tests/cli/ExceptionInBeforeDoesNotMakeFatalErrorCept.php
vendored
Normal file
14
vendor/codeception/base/tests/cli/ExceptionInBeforeDoesNotMakeFatalErrorCept.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$I = new CliGuy($scenario);
|
||||
$I->wantTo('see that exception in before does not cause fatal error in after');
|
||||
$I->amInPath('tests/data/exception_in_before');
|
||||
$I->executeFailCommand('run --xml --no-ansi');
|
||||
$I->seeInShellOutput('[Exception] in before');
|
||||
$I->dontSeeInShellOutput('[RuntimeException] in cept');
|
||||
$I->dontSeeInShellOutput('[RuntimeException] in cest');
|
||||
$I->dontSeeInShellOutput('[RuntimeException] in gherkin');
|
||||
$I->seeInShellOutput('Tests: 4, Assertions: 0, Errors: 5');
|
||||
|
||||
//@todo if Unit format is ever fixed in PHPUnit, uncomment these lines
|
||||
//$I->dontSeeInShellOutput('[RuntimeException] in test');
|
||||
//$I->seeInShellOutput('Tests: 4, Assertions: 0, Errors: 4');
|
||||
92
vendor/codeception/base/tests/cli/ExtensionsCest.php
vendored
Normal file
92
vendor/codeception/base/tests/cli/ExtensionsCest.php
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
class ExtensionsCest
|
||||
{
|
||||
// tests
|
||||
public function useAlternativeFormatter(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('use alternative formatter delivered through extensions');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run tests/dummy/FileExistsCept.php -c codeception_extended.yml');
|
||||
$I->dontSeeInShellOutput("Check config");
|
||||
$I->seeInShellOutput('[+] FileExistsCept');
|
||||
$I->seeInShellOutput('Modules used: Filesystem, DumbHelper');
|
||||
}
|
||||
|
||||
public function loadExtensionByOverride(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run tests/dummy/FileExistsCept.php -o "extensions: enabled: [\Codeception\Extension\SimpleReporter]"');
|
||||
$I->dontSeeInShellOutput("Check config");
|
||||
$I->seeInShellOutput('[+] FileExistsCept');
|
||||
}
|
||||
|
||||
public function dynamicallyEnablingExtensions(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run dummy --ext DotReporter');
|
||||
$I->seeInShellOutput('......');
|
||||
$I->dontSeeInShellOutput('Optimistic');
|
||||
$I->dontSeeInShellOutput('AnotherCest');
|
||||
}
|
||||
|
||||
public function reRunFailedTests(CliGuy $I)
|
||||
{
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
|
||||
$I->executeCommand('run unit FailingTest.php -c codeception_extended.yml --no-exit');
|
||||
$I->seeInShellOutput('FAILURES');
|
||||
$I->seeFileFound('failed', 'tests/_output');
|
||||
$I->seeFileContentsEqual("tests{$ds}unit{$ds}FailingTest.php:testMe");
|
||||
$I->executeCommand('run -g failed -c codeception_extended.yml --no-exit');
|
||||
$I->seeInShellOutput('Tests: 1, Assertions: 1, Failures: 1');
|
||||
|
||||
$failGroup = "some-failed";
|
||||
$I->executeCommand("run unit FailingTest.php -c codeception_extended.yml --no-exit --override \"extensions: config: Codeception\\Extension\\RunFailed: fail-group: {$failGroup}\"");
|
||||
$I->seeInShellOutput('FAILURES');
|
||||
$I->seeFileFound($failGroup, 'tests/_output');
|
||||
$I->seeFileContentsEqual("tests{$ds}unit{$ds}FailingTest.php:testMe");
|
||||
$I->executeCommand("run -g {$failGroup} -c codeception_extended.yml --no-exit --override \"extensions: config: Codeception\\Extension\\RunFailed: fail-group: {$failGroup}\"");
|
||||
$I->seeInShellOutput('Tests: 1, Assertions: 1, Failures: 1');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
public function runPerSuiteExtensions(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run extended,scenario', false);
|
||||
$I->seeInShellOutput('Suite setup for extended');
|
||||
$I->seeInShellOutput('Test setup for Hello');
|
||||
$I->seeInShellOutput('Test teardown for Hello');
|
||||
$I->seeInShellOutput('Suite teardown for extended');
|
||||
$I->dontSeeInShellOutput('Suite setup for scenario');
|
||||
$I->seeInShellOutput('Config1: value1');
|
||||
$I->seeInShellOutput('Config2: value2');
|
||||
}
|
||||
|
||||
public function runPerSuiteExtensionsInEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run extended --env black', false);
|
||||
$I->seeInShellOutput('Suite setup for extended');
|
||||
$I->seeInShellOutput('Test setup for Hello');
|
||||
$I->seeInShellOutput('Config1: black_value');
|
||||
$I->seeInShellOutput('Config2: value2');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
vendor/codeception/base/tests/cli/GenerateCeptCept.php
vendored
Normal file
22
vendor/codeception/base/tests/cli/GenerateCeptCept.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
$I = new CliGuy($scenario);
|
||||
$I->wantTo('generate sample Cept');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:cept dummy DummyCept');
|
||||
$I->seeFileFound('DummyCept.php', 'tests/dummy');
|
||||
$I->seeInThisFile('$I = new DumbGuy($scenario);');
|
||||
$I->deleteThisFile();
|
||||
|
||||
$I->amGoingTo('create scenario in folder');
|
||||
$I->executeCommand('generate:cept dummy path/DummyCept');
|
||||
$I->seeFileFound('DummyCept.php', 'tests/dummy/path');
|
||||
$I->deleteThisFile();
|
||||
|
||||
$I->amGoingTo('create file with Cept.php suffix');
|
||||
$I->executeCommand('generate:cept dummy DummyCept.php');
|
||||
$I->seeFileFound('DummyCept.php');
|
||||
$I->deleteThisFile();
|
||||
|
||||
$I->amGoingTo('create file without any suffix');
|
||||
$I->executeCommand('generate:cept dummy Dummy');
|
||||
$I->seeFileFound('DummyCept.php');
|
||||
6
vendor/codeception/base/tests/cli/GenerateCestCept.php
vendored
Normal file
6
vendor/codeception/base/tests/cli/GenerateCestCept.php
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$I = new CliGuy\GeneratorSteps($scenario);
|
||||
$I->wantTo('generate sample Cest');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:cest dummy DummyClass');
|
||||
$I->seeFileWithGeneratedClass('DummyClass');
|
||||
13
vendor/codeception/base/tests/cli/GenerateFeatureCept.php
vendored
Normal file
13
vendor/codeception/base/tests/cli/GenerateFeatureCept.php
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?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');
|
||||
9
vendor/codeception/base/tests/cli/GenerateGroupCept.php
vendored
Normal file
9
vendor/codeception/base/tests/cli/GenerateGroupCept.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$I = new CliGuy\GeneratorSteps($scenario);
|
||||
$I->wantTo('generate new group');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:group core');
|
||||
$I->seeFileWithGeneratedClass('Core', 'tests/_support/Group');
|
||||
$I->seeInThisFile("static \$group = 'core'");
|
||||
$I->dontSeeInThisFile('public function _before(\Codeception\Event\Test \$e)');
|
||||
$I->seeFileFound('tests/_bootstrap.php');
|
||||
7
vendor/codeception/base/tests/cli/GenerateHelperCept.php
vendored
Normal file
7
vendor/codeception/base/tests/cli/GenerateHelperCept.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$I = new CliGuy\GeneratorSteps($scenario);
|
||||
$I->wantTo('generate helper');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:helper Db');
|
||||
$I->seeFileWithGeneratedClass('Db', 'tests/_support/Helper');
|
||||
$I->seeInThisFile('Db extends \Codeception\Module');
|
||||
38
vendor/codeception/base/tests/cli/GeneratePageObjectCest.php
vendored
Normal file
38
vendor/codeception/base/tests/cli/GeneratePageObjectCest.php
vendored
Normal file
@@ -0,0 +1,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');
|
||||
}
|
||||
}
|
||||
14
vendor/codeception/base/tests/cli/GenerateScenariosCept.php
vendored
Normal file
14
vendor/codeception/base/tests/cli/GenerateScenariosCept.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$I = new CliGuy($scenario);
|
||||
$I->wantTo('generate test scenario');
|
||||
$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"
|
||||
|
||||
|
||||
EOF
|
||||
);
|
||||
7
vendor/codeception/base/tests/cli/GenerateStepObjectCept.php
vendored
Normal file
7
vendor/codeception/base/tests/cli/GenerateStepObjectCept.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$I = new CliGuy\GeneratorSteps($scenario);
|
||||
$I->wantTo('generate step object');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:stepobject dummy Login --silent');
|
||||
$I->seeFileWithGeneratedClass('Login', 'tests/_support/Step/Dummy');
|
||||
$I->seeInThisFile('Login extends \DumbGuy');
|
||||
39
vendor/codeception/base/tests/cli/GenerateSuiteCest.php
vendored
Normal file
39
vendor/codeception/base/tests/cli/GenerateSuiteCest.php
vendored
Normal file
@@ -0,0 +1,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');
|
||||
}
|
||||
}
|
||||
9
vendor/codeception/base/tests/cli/GenerateTestCept.php
vendored
Normal file
9
vendor/codeception/base/tests/cli/GenerateTestCept.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
$I = new CliGuy\GeneratorSteps($scenario);
|
||||
$I->wantTo('generate sample Test');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('generate:test dummy Sommy');
|
||||
$I->seeFileWithGeneratedClass('SommyTest');
|
||||
$I->seeInThisFile('class SommyTest extends \Codeception\Test\Unit');
|
||||
$I->seeInThisFile('protected $tester');
|
||||
$I->seeInThisFile("function _before(");
|
||||
75
vendor/codeception/base/tests/cli/GherkinCest.php
vendored
Normal file
75
vendor/codeception/base/tests/cli/GherkinCest.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @group gherkin
|
||||
*/
|
||||
class GherkinCest
|
||||
{
|
||||
public function _before(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
}
|
||||
|
||||
public function steps(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('gherkin:steps scenario');
|
||||
$I->seeInShellOutput('I have terminal opened');
|
||||
$I->seeInShellOutput('ScenarioGuy::terminal');
|
||||
$I->seeInShellOutput('there is a file :name');
|
||||
$I->seeInShellOutput('I see file :name');
|
||||
$I->seeInShellOutput('ScenarioGuy::matchFile');
|
||||
}
|
||||
|
||||
public function snippets(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('gherkin:snippets scenario');
|
||||
$I->seeInShellOutput('@Given I have only idea of what\'s going on here');
|
||||
$I->seeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
|
||||
}
|
||||
|
||||
public function snippetsScenarioFile(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('gherkin:snippets scenario FileExamples.feature');
|
||||
$I->dontSeeInShellOutput('@Given I have only idea of what\'s going on here');
|
||||
$I->dontSeeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
|
||||
}
|
||||
|
||||
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 snippetsPyStringArgument(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('gherkin:snippets scenario PyStringArgumentExample.feature');
|
||||
$I->seeInShellOutput('@Given I have PyString argument :arg1');
|
||||
$I->seeInShellOutput('public function iHavePyStringArgument($arg1)');
|
||||
$I->dontSeeInShellOutput('public function iSeeOutput($arg1)');
|
||||
}
|
||||
|
||||
public function runIncompletedStepWithPyStringArgument(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario "PyStringArgumentExample.feature:PyString argument" --steps');
|
||||
$I->seeInShellOutput('Step definition for `I have PyString argument ""` not found in contexts');
|
||||
$I->dontSeeInShellOutput('Step definition for `I see output` not found in contexts');
|
||||
}
|
||||
|
||||
public function runSameStepWithInlineAndPyStringArgument(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario "InlineArgumentExample.feature:Running step with inline argument" --steps');
|
||||
$I->seeInShellOutput("Argument: test");
|
||||
|
||||
$I->executeCommand('run scenario "PyStringArgumentExample.feature:Running step with PyString argument" --steps');
|
||||
$I->seeInShellOutput("Argument: First line\nSecond line");
|
||||
}
|
||||
|
||||
public function snippetsScenarioUtf8(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('gherkin:snippets scenario Utf8Example.feature');
|
||||
$I->seeInShellOutput('@Given я написал сценарий на языке :arg1');
|
||||
$I->seeInShellOutput('public function step_62e20dc62($arg1)');
|
||||
}
|
||||
}
|
||||
60
vendor/codeception/base/tests/cli/GlobalCommandOptionCest.php
vendored
Normal file
60
vendor/codeception/base/tests/cli/GlobalCommandOptionCest.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class GlobalCommandOptionCest
|
||||
{
|
||||
public function configOption(CliGuy $I)
|
||||
{
|
||||
$I->wantTo("start codeception with --config option");
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('--config standard/codeception.yml');
|
||||
$I->seeInShellOutput('myProject:myCommand');
|
||||
}
|
||||
|
||||
public function configOptionWithEqualSign(CliGuy $I)
|
||||
{
|
||||
$I->wantTo("start codeception with --config= option");
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('--config=standard/codeception.yml');
|
||||
$I->seeInShellOutput('myProject:myCommand');
|
||||
}
|
||||
|
||||
public function configOptionShortcut(CliGuy $I)
|
||||
{
|
||||
$I->wantTo("start codeception with shortcut -c option");
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('-c standard/codeception.yml');
|
||||
$I->seeInShellOutput('myProject:myCommand');
|
||||
}
|
||||
|
||||
public function configOptionShortcutWithoutSpace(CliGuy $I)
|
||||
{
|
||||
$I->wantTo("start codeception with shortcut -c option and not Space");
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('-cstandard/codeception.yml');
|
||||
$I->seeInShellOutput('myProject:myCommand');
|
||||
}
|
||||
|
||||
public function configOptionShortcutWithoutSpaceAndOther(CliGuy $I)
|
||||
{
|
||||
$I->wantTo("start codeception with two shortcuts and -c option has not Space");
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('-vcstandard/codeception.yml');
|
||||
$I->seeInShellOutput('version');
|
||||
}
|
||||
|
||||
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:');
|
||||
}
|
||||
|
||||
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.');
|
||||
}
|
||||
}
|
||||
9
vendor/codeception/base/tests/cli/GroupEventsCept.php
vendored
Normal file
9
vendor/codeception/base/tests/cli/GroupEventsCept.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?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 --no-colors');
|
||||
$I->seeInShellOutput('Group Before Events: 1');
|
||||
$I->dontSeeInShellOutput('Group Before Events: 2');
|
||||
$I->seeInShellOutput('Group After Events: 1');
|
||||
$I->dontSeeInShellOutput('Group After Events: 2');
|
||||
10
vendor/codeception/base/tests/cli/GroupExtensionCept.php
vendored
Normal file
10
vendor/codeception/base/tests/cli/GroupExtensionCept.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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');
|
||||
167
vendor/codeception/base/tests/cli/IncludedCest.php
vendored
Normal file
167
vendor/codeception/base/tests/cli/IncludedCest.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
class IncludedCest
|
||||
{
|
||||
|
||||
public function _before()
|
||||
{
|
||||
\Codeception\Util\FileSystem::doEmptyDir('tests/data/included/_log');
|
||||
file_put_contents('tests/data/included/_log/.gitkeep', '');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
protected function moveToIncluded(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/included');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestsFromIncludedConfigs(\CliGuy $I)
|
||||
{
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$I->executeCommand("run jazz{$ds}tests{$ds}functional{$ds}DemoCept.php", false);
|
||||
|
||||
// Suite is not run
|
||||
$I->dontSeeInShellOutput('[Jazz]');
|
||||
|
||||
// DemoCept tests are run
|
||||
$I->seeInShellOutput('Jazz.functional Tests');
|
||||
$I->seeInShellOutput('DemoCept');
|
||||
|
||||
// Other include tests are not run
|
||||
$I->dontSeeInShellOutput('[Shire]');
|
||||
$I->dontSeeInShellOutput('Shire.functional Tests');
|
||||
$I->dontSeeInShellOutput('[Jazz\Pianist]');
|
||||
$I->dontSeeInShellOutput('Jazz\Pianist.functional Tests');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestsFromIncludedConfigsNested(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run jazz/pianist/tests/functional/PianistCept.php', false);
|
||||
|
||||
// Suite is not run
|
||||
$I->dontSeeInShellOutput('[Jazz\Pianist]');
|
||||
|
||||
// DemoCept tests are run
|
||||
$I->seeInShellOutput('Jazz\Pianist.functional Tests');
|
||||
$I->seeInShellOutput('PianistCept');
|
||||
|
||||
// Other include tests are not run
|
||||
$I->dontSeeInShellOutput('[Shire]');
|
||||
$I->dontSeeInShellOutput('Shire.functional Tests');
|
||||
$I->dontSeeInShellOutput('[Jazz]');
|
||||
$I->dontSeeInShellOutput('Jazz.functional Tests');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestsFromIncludedConfigsSingleTest(\CliGuy $I)
|
||||
{
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$I->executeCommand("run jazz{$ds}tests{$ds}unit{$ds}SimpleTest.php:testSimple", false);
|
||||
|
||||
// Suite is not run
|
||||
$I->dontSeeInShellOutput('[Jazz]');
|
||||
|
||||
// SimpleTest:testSimple is run
|
||||
$I->seeInShellOutput('Jazz.unit Tests');
|
||||
$I->dontSeeInShellOutput('Jazz.functional Tests');
|
||||
$I->seeInShellOutput('SimpleTest');
|
||||
|
||||
// SimpleTest:testSimpler is not run
|
||||
$I->dontSeeInShellOutput('SimplerTest');
|
||||
|
||||
// Other include tests are not run
|
||||
$I->dontSeeInShellOutput('[Shire]');
|
||||
$I->dontSeeInShellOutput('Shire.functional Tests');
|
||||
$I->dontSeeInShellOutput('[Jazz\Pianist]');
|
||||
$I->dontSeeInShellOutput('Jazz\Pianist.functional Tests');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedWithXmlOutput(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run --xml');
|
||||
$I->amInPath('_log');
|
||||
$I->seeFileFound('report.xml');
|
||||
$I->seeInThisFile('<testsuite name="Jazz.functional" tests="1" assertions="1"');
|
||||
$I->seeInThisFile('<testsuite name="Jazz\Pianist.functional" tests="1" assertions="1"');
|
||||
$I->seeInThisFile('<testsuite name="Shire.functional" tests="1" assertions="1"');
|
||||
$I->seeInThisFile('<testcase name="Hobbit"');
|
||||
$I->seeInThisFile('<testcase name="Demo"');
|
||||
$I->seeInThisFile('<testcase name="Pianist"');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedWithHtmlOutput(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run --html');
|
||||
$I->amInPath('_log');
|
||||
$I->seeFileFound('report.html');
|
||||
$I->seeInThisFile('Codeception Results');
|
||||
$I->seeInThisFile('Jazz.functional Tests');
|
||||
$I->seeInThisFile('Check that jazz musicians can add numbers');
|
||||
$I->seeInThisFile('Jazz\Pianist.functional Tests');
|
||||
$I->seeInThisFile('Check that jazz pianists can add numbers');
|
||||
$I->seeInThisFile('Shire.functional Tests');
|
||||
}
|
||||
|
||||
/**
|
||||
* @before moveToIncluded
|
||||
* @group coverage
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedWithCoverage(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run --coverage-xml');
|
||||
$I->amInPath('_log');
|
||||
$I->seeFileFound('coverage.xml');
|
||||
$I->seeInThisFile('BillEvans" namespace="Jazz\Pianist">');
|
||||
$I->seeInThisFile('Musician" namespace="Jazz">');
|
||||
$I->seeInThisFile('Hobbit" namespace="Shire">');
|
||||
}
|
||||
|
||||
/**
|
||||
* @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');
|
||||
}
|
||||
}
|
||||
28
vendor/codeception/base/tests/cli/MixedIncludeCest.php
vendored
Normal file
28
vendor/codeception/base/tests/cli/MixedIncludeCest.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
class MixedIncludeCest
|
||||
{
|
||||
/**
|
||||
* @after checkAllSuitesExecuted
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedSuites(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/included_mix');
|
||||
$I->executeCommand('run');
|
||||
}
|
||||
|
||||
/**
|
||||
* @after checkAllSuitesExecuted
|
||||
* @param \CliGuy $I
|
||||
*/
|
||||
public function runIncludedSuiteFromCurrentDir(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -c tests/data/included_mix');
|
||||
}
|
||||
|
||||
protected function checkAllSuitesExecuted(\CliGuy $I)
|
||||
{
|
||||
$I->seeInShellOutput('AcmePack.unit Tests (1)');
|
||||
$I->seeInShellOutput('Unit Tests (1)');
|
||||
}
|
||||
}
|
||||
117
vendor/codeception/base/tests/cli/OrderCest.php
vendored
Normal file
117
vendor/codeception/base/tests/cli/OrderCest.php
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
class OrderCest
|
||||
{
|
||||
public function checkOneFile(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order LoadingOrderCept.php');
|
||||
$I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap(B), test(T), after, afterSuite');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeFileContentsEqual("BIB([ST])");
|
||||
}
|
||||
|
||||
public function checkForFails(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order FailedCept.php --no-exit');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap, test, fail, after, afterSuite');
|
||||
$I->seeFileContentsEqual("BIB([STF])");
|
||||
}
|
||||
|
||||
public function checkForCanCantFails(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order CanCantFailCept.php --no-exit');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->expect(
|
||||
'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
|
||||
. ' fail, fail, test, after, afterSuite'
|
||||
);
|
||||
$I->seeFileContentsEqual("BIB([STFFT])");
|
||||
}
|
||||
|
||||
public function checkForCanCantFailsInCest(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order CanCantFailCest.php --no-exit');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->expect(
|
||||
'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
|
||||
. ' fail, fail, test, test, fail, fail, test, after, afterSuite'
|
||||
);
|
||||
$I->seeFileContentsEqual("BIB([TFT][TFT])");
|
||||
}
|
||||
|
||||
public function checkSimpleFiles(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order --no-exit --group simple');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeFileContentsEqual("BIBP({{{{[ST][STFFT][STF][ST]}}}})");
|
||||
}
|
||||
|
||||
public function checkCestOrder(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run tests/order/ReorderCest.php --no-exit');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeFileContentsEqual("BIB([0123456])");
|
||||
}
|
||||
|
||||
public function checkFailingCestOrder(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run tests/order/FailedCest.php --no-exit -vvv');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeFileContentsEqual("BIB([a%F])");
|
||||
}
|
||||
|
||||
public function checkCodeceptionTest(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order CodeTest.php --no-exit');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->expect('
|
||||
global bootstrap,
|
||||
initialization,
|
||||
beforeSuite,
|
||||
beforeClass,
|
||||
@beforeClass,
|
||||
bootstrap,
|
||||
before,
|
||||
@before
|
||||
test,
|
||||
after,
|
||||
@after,
|
||||
afterSuite,
|
||||
afterClass,
|
||||
@afterClass');
|
||||
$I->seeFileContentsEqual("BIB({{[<C>]}})");
|
||||
}
|
||||
|
||||
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]})');
|
||||
}
|
||||
|
||||
public function checkAfterBeforeClassInTestWithDataProvider(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order BeforeAfterClassWithDataProviderTest.php');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeInThisFile('BIB({[A][B][C]})');
|
||||
}
|
||||
|
||||
public function checkBootstrapIsLoadedBeforeTests(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run order ParsedLoadedTest.php');
|
||||
$I->seeFileFound('order.txt', 'tests/_output');
|
||||
$I->seeInThisFile('BIBP(T)');
|
||||
}
|
||||
}
|
||||
35
vendor/codeception/base/tests/cli/RegisterCommandCest.php
vendored
Normal file
35
vendor/codeception/base/tests/cli/RegisterCommandCest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
class RegisterCommandCest
|
||||
{
|
||||
public function registerCommand(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/register_command/standard');
|
||||
$I->executeCommand('list');
|
||||
$I->seeInShellOutput('myProject:myCommand');
|
||||
}
|
||||
|
||||
public function registerCommandWithConfigurationAtNewPlace(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/register_command/');
|
||||
$I->executeCommand('list -c standard/codeception.yml');
|
||||
$I->seeInShellOutput('myProject:yourCommand');
|
||||
}
|
||||
|
||||
public function startMyCommand(CliGuy $I)
|
||||
{
|
||||
$myname = get_current_user();
|
||||
$I->amInPath('tests/data/register_command/standard');
|
||||
$I->executeCommand('myProject:myCommand');
|
||||
$I->seeInShellOutput("Hello {$myname}!");
|
||||
}
|
||||
|
||||
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?");
|
||||
}
|
||||
}
|
||||
498
vendor/codeception/base/tests/cli/RunCest.php
vendored
Normal file
498
vendor/codeception/base/tests/cli/RunCest.php
vendored
Normal file
@@ -0,0 +1,498 @@
|
||||
<?php
|
||||
|
||||
class RunCest
|
||||
{
|
||||
public function _before(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
}
|
||||
|
||||
public function runOneFile(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute one test');
|
||||
$I->executeCommand('run tests/dummy/FileExistsCept.php');
|
||||
$I->seeInShellOutput("OK (");
|
||||
}
|
||||
|
||||
public function runOneFileWithColors(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute one test');
|
||||
$I->executeCommand('run --colors tests/dummy/FileExistsCept.php');
|
||||
$I->seeInShellOutput("OK (");
|
||||
$I->seeInShellOutput("\033[35;1mFileExistsCept:\033[39;22m Check config exists");
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
* @group core
|
||||
*
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runHtml(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute tests with html output');
|
||||
$I->executeCommand('run dummy --html');
|
||||
$I->seeFileFound('report.html', 'tests/_output');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
*
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runJsonReport(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('check json reports');
|
||||
$I->executeCommand('run dummy --json');
|
||||
$I->seeFileFound('report.json', 'tests/_output');
|
||||
$I->seeInThisFile('"suite":');
|
||||
$I->seeInThisFile('"dummy"');
|
||||
$I->assertNotNull(json_decode(file_get_contents('tests/_output/report.json')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
*
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTapReport(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('check tap reports');
|
||||
$I->executeCommand('run dummy --tap');
|
||||
$I->seeFileFound('report.tap.log', 'tests/_output');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
*
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runXmlReport(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('check xml reports');
|
||||
$I->executeCommand('run dummy --xml');
|
||||
$I->seeFileFound('report.xml', 'tests/_output');
|
||||
$I->seeInThisFile('<?xml');
|
||||
$I->seeInThisFile('<testsuite name="dummy"');
|
||||
$I->seeInThisFile('<testcase name="FileExists"');
|
||||
$I->seeInThisFile('feature="');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runXmlReportsInStrictMode(\CliGuy $I)
|
||||
{
|
||||
$I->wantTo('check xml in strict mode');
|
||||
$I->executeCommand('run dummy --xml -c codeception_strict_xml.yml');
|
||||
$I->seeFileFound('report.xml', 'tests/_output');
|
||||
$I->seeInThisFile('<?xml');
|
||||
$I->seeInThisFile('<testsuite name="dummy"');
|
||||
$I->seeInThisFile('<testcase name="FileExists"');
|
||||
$I->dontSeeInThisFile('feature="');
|
||||
}
|
||||
|
||||
/**
|
||||
* @group reports
|
||||
*
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runCustomReport(\CliGuy $I)
|
||||
{
|
||||
if (\PHPUnit\Runner\Version::series() >= 7) {
|
||||
throw new \Codeception\Exception\Skip('Not for PHPUnit 7');
|
||||
}
|
||||
$I->executeCommand('run dummy --report -c codeception_custom_report.yml');
|
||||
$I->seeInShellOutput('FileExistsCept: Check config exists');
|
||||
$I->dontSeeInShellOutput('Ok');
|
||||
}
|
||||
|
||||
public function runOneGroup(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run skipped -g notorun');
|
||||
$I->seeInShellOutput('Skipped Tests (1)');
|
||||
$I->seeInShellOutput("IncompleteMeCept");
|
||||
$I->dontSeeInShellOutput("SkipMeCept");
|
||||
}
|
||||
|
||||
public function skipRunOneGroup(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run skipped --skip-group notorun');
|
||||
$I->seeInShellOutput('Skipped Tests (2)');
|
||||
$I->seeInShellOutput("SkipMeCept");
|
||||
$I->dontSeeInShellOutput("IncompleteMeCept");
|
||||
}
|
||||
|
||||
public function skipGroupOfCest(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run dummy');
|
||||
$I->seeInShellOutput('Optimistic');
|
||||
$I->seeInShellOutput('Dummy Tests (6)');
|
||||
$I->executeCommand('run dummy --skip-group ok');
|
||||
$I->seeInShellOutput('Pessimistic');
|
||||
$I->seeInShellOutput('Dummy Tests (5)');
|
||||
$I->dontSeeInShellOutput('Optimistic');
|
||||
}
|
||||
|
||||
public function runTwoSuites(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run skipped,dummy --no-exit');
|
||||
$I->seeInShellOutput("Skipped Tests (3)");
|
||||
$I->seeInShellOutput("Dummy Tests (6)");
|
||||
$I->dontSeeInShellOutput("Remote Tests");
|
||||
}
|
||||
|
||||
public function skipSuites(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand(
|
||||
'run dummy --skip skipped --skip remote --skip remote_server --skip order --skip unit '
|
||||
. '--skip powers --skip math --skip messages'
|
||||
);
|
||||
$I->seeInShellOutput("Dummy Tests");
|
||||
$I->dontSeeInShellOutput("Remote Tests");
|
||||
$I->dontSeeInShellOutput("Remote_server Tests");
|
||||
$I->dontSeeInShellOutput("Order Tests");
|
||||
}
|
||||
|
||||
public function runOneTestFromUnit(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run tests/dummy/AnotherTest.php:testFirst');
|
||||
$I->seeInShellOutput("AnotherTest: First");
|
||||
$I->seeInShellOutput('OK');
|
||||
$I->dontSeeInShellOutput('AnotherTest: Second');
|
||||
}
|
||||
|
||||
public function runOneTestFromCest(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run tests/dummy/AnotherCest.php:optimistic');
|
||||
$I->seeInShellOutput("Optimistic");
|
||||
$I->dontSeeInShellOutput('Pessimistic');
|
||||
}
|
||||
|
||||
public function runTestWithDataProviders(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run tests/unit/DataProvidersTest.php');
|
||||
$I->seeInShellOutput('Is triangle | "real triangle"');
|
||||
$I->seeInShellOutput('Is triangle | #0');
|
||||
$I->seeInShellOutput('Is triangle | #1');
|
||||
$I->seeInShellOutput('DataProvidersTest');
|
||||
$I->seeInShellOutput("OK");
|
||||
}
|
||||
|
||||
public function runOneGroupWithDataProviders(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run unit -g data-providers');
|
||||
$I->seeInShellOutput('Is triangle | "real triangle"');
|
||||
$I->seeInShellOutput('Is triangle | #0');
|
||||
$I->seeInShellOutput('Is triangle | #1');
|
||||
$I->seeInShellOutput('DataProvidersTest');
|
||||
$I->seeInShellOutput("OK");
|
||||
}
|
||||
|
||||
public function runTestWithFailFast(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run unit --skip-group error --no-exit');
|
||||
$I->seeInShellOutput('FailingTest: Me');
|
||||
$I->seeInShellOutput("PassingTest: Me");
|
||||
$I->executeCommand('run unit --fail-fast --skip-group error --no-exit');
|
||||
$I->seeInShellOutput('There was 1 failure');
|
||||
$I->dontSeeInShellOutput("PassingTest: Me");
|
||||
}
|
||||
|
||||
public function runWithCustomOutputPath(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run dummy --xml myverycustom.xml --html myownhtmlreport.html');
|
||||
$I->seeFileFound('myverycustom.xml', 'tests/_output');
|
||||
$I->seeInThisFile('<?xml');
|
||||
$I->seeInThisFile('<testsuite name="dummy"');
|
||||
$I->seeInThisFile('<testcase name="FileExists"');
|
||||
$I->seeFileFound('myownhtmlreport.html', 'tests/_output');
|
||||
$I->dontSeeFileFound('report.xml', 'tests/_output');
|
||||
$I->dontSeeFileFound('report.html', 'tests/_output');
|
||||
}
|
||||
|
||||
public function runTestsWithDependencyInjections(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run math');
|
||||
$I->seeInShellOutput('MathCest: Test addition');
|
||||
$I->seeInShellOutput('MathCest: Test subtraction');
|
||||
$I->seeInShellOutput('MathCest: Test square');
|
||||
$I->seeInShellOutput('MathTest: All');
|
||||
$I->seeInShellOutput('OK (');
|
||||
$I->dontSeeInShellOutput('fail');
|
||||
$I->dontSeeInShellOutput('error');
|
||||
}
|
||||
|
||||
public function runErrorTest(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run unit ErrorTest --no-exit');
|
||||
$I->seeInShellOutput('There was 1 error');
|
||||
$I->seeInShellOutput('Array to string conversion');
|
||||
$I->seeInShellOutput('ErrorTest.php');
|
||||
}
|
||||
|
||||
public function runTestWithException(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run unit ExceptionTest --no-exit -v');
|
||||
$I->seeInShellOutput('There was 1 error');
|
||||
$I->seeInShellOutput('Helllo!');
|
||||
$I->expect('Exceptions are not wrapped into ExceptionWrapper');
|
||||
$I->dontSeeInShellOutput('PHPUnit_Framework_ExceptionWrapper');
|
||||
$I->seeInShellOutput('RuntimeException');
|
||||
}
|
||||
|
||||
public function runTestsWithSteps(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario SuccessCept --steps');
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
Scenario --
|
||||
I am in path "."
|
||||
I see file found "scenario.suite.yml"
|
||||
PASSED
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestWithFailedScenario(\CliGuy $I, $scenario)
|
||||
{
|
||||
if (!extension_loaded('xdebug') && !defined('HHVM_VERSION')) {
|
||||
$scenario->skip("Xdebug not loaded");
|
||||
}
|
||||
$I->executeCommand('run scenario FailedCept --steps --no-exit');
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
FailedCept: Fail when file is not found
|
||||
Signature: FailedCept
|
||||
Test: tests/scenario/FailedCept.php
|
||||
Scenario --
|
||||
I am in path "."
|
||||
I see file found "games.zip"
|
||||
FAIL
|
||||
EOF
|
||||
);
|
||||
$I->expect('to see scenario trace');
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
Scenario Steps:
|
||||
|
||||
2. \$I->seeFileFound("games.zip") at tests/scenario/FailedCept.php:5
|
||||
1. \$I->amInPath(".") at tests/scenario/FailedCept.php:4
|
||||
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runTestWithSubSteps(\CliGuy $I, $scenario)
|
||||
{
|
||||
if (!extension_loaded('xdebug') && !defined('HHVM_VERSION')) {
|
||||
$scenario->skip("Xdebug not loaded");
|
||||
}
|
||||
|
||||
$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
|
||||
EOF
|
||||
);
|
||||
// I split this assertion into two, because extra space is printed after "present" on HHVM
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
I see file found "c3.php"
|
||||
I see file found "composer.json"
|
||||
I see in this file "$file"
|
||||
EOF
|
||||
);
|
||||
}
|
||||
|
||||
public function runDependentCest(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run order DependentCest --no-exit');
|
||||
$I->seeInShellOutput('Skipped: 1');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
public function runGherkinTest(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario File.feature --steps');
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
In order to test a feature
|
||||
As a user
|
||||
I need to be able to see output
|
||||
EOF
|
||||
);
|
||||
$I->seeInShellOutput('Given i have terminal opened');
|
||||
$I->seeInShellOutput('When i am in current directory');
|
||||
$I->seeInShellOutput('Then there is a file "scenario.suite.yml"');
|
||||
$I->seeInShellOutput('And there are keywords in "scenario.suite.yml"');
|
||||
$I->seeInShellOutput(<<<EOF
|
||||
| class_name | ScenarioGuy |
|
||||
| enabled | Filesystem |
|
||||
EOF
|
||||
);
|
||||
$I->seeInShellOutput('PASSED');
|
||||
}
|
||||
|
||||
public function reportsCorrectFailedStep(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario File.feature -v');
|
||||
$I->seeInShellOutput('OK, but incomplete');
|
||||
$I->seeInShellOutput('Step definition for `I have only idea of what\'s going on here` not found in contexts');
|
||||
}
|
||||
|
||||
public function runFailingGherkinTest(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario Fail.feature -v --no-exit');
|
||||
$I->seeInShellOutput('Step I see file "games.zip"');
|
||||
$I->seeInShellOutput('Step I see file "tools.zip"');
|
||||
}
|
||||
|
||||
public function runGherkinScenarioWithMultipleStepDefinitions(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario "File.feature:Check file once more" --steps');
|
||||
$I->seeInShellOutput('When there is a file "scenario.suite.yml"');
|
||||
$I->seeInShellOutput('Then i see file "scenario.suite.yml"');
|
||||
$I->dontSeeInShellOutput('Step definition for `I see file "scenario.suite.yml"` not found in contexts');
|
||||
$I->seeInShellOutput('PASSED');
|
||||
}
|
||||
|
||||
public function runGherkinScenarioOutline(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario FileExamples.feature -v');
|
||||
$I->seeInShellOutput('OK (3 tests');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
* @after checkExampleFiles
|
||||
*/
|
||||
public function runTestWithAnnotationExamples(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario ExamplesCest:filesExistsAnnotation --steps');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
* @after checkExampleFiles
|
||||
*/
|
||||
public function runTestWithJsonExamples(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario ExamplesCest:filesExistsByJson --steps');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param CliGuy $I
|
||||
* @after checkExampleFiles
|
||||
*/
|
||||
public function runTestWithArrayExamples(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario ExamplesCest:filesExistsByArray --steps');
|
||||
}
|
||||
|
||||
protected function checkExampleFiles(CliGuy $I)
|
||||
{
|
||||
$I->seeInShellOutput('OK (3 tests');
|
||||
$I->seeInShellOutput('I see file found "scenario.suite.yml"');
|
||||
$I->seeInShellOutput('I see file found "dummy.suite.yml"');
|
||||
$I->seeInShellOutput('I see file found "unit.suite.yml"');
|
||||
}
|
||||
|
||||
public function runTestWithComplexExample(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario ExamplesCest:filesExistsComplexJson --debug');
|
||||
$I->seeInShellOutput('Files exists complex json | {"path":"."');
|
||||
$I->seeInShellOutput('OK (1 test');
|
||||
$I->seeInShellOutput('I see file found "scenario.suite.yml"');
|
||||
$I->seeInShellOutput('I see file found "dummy.suite.yml"');
|
||||
$I->seeInShellOutput('I see file found "unit.suite.yml"');
|
||||
}
|
||||
|
||||
public function overrideConfigOptionsToChangeReporter(CliGuy $I)
|
||||
{
|
||||
if (!class_exists('PHPUnit_Util_Log_TeamCity')) {
|
||||
throw new \Codeception\Exception\Skip('Reporter does not exist for this PHPUnit version');
|
||||
}
|
||||
$I->executeCommand('run scenario --report -o "reporters: report: PHPUnit_Util_Log_TeamCity" --no-exit');
|
||||
$I->seeInShellOutput('##teamcity[testStarted');
|
||||
$I->dontSeeInShellOutput('............Ok');
|
||||
}
|
||||
|
||||
public function overrideModuleOptions(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run powers PowerIsRisingCept --no-exit');
|
||||
$I->seeInShellOutput('FAILURES');
|
||||
$I->executeCommand('run powers PowerIsRisingCept -o "modules: config: PowerHelper: has_power: true" --no-exit');
|
||||
$I->dontSeeInShellOutput('FAILURES');
|
||||
}
|
||||
|
||||
|
||||
public function runTestWithAnnotationExamplesFromGroupFileTest(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario -g groupFileTest1 --steps');
|
||||
$I->seeInShellOutput('OK (3 tests');
|
||||
}
|
||||
|
||||
public function testsWithConditionalFails(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario ConditionalCept --no-exit');
|
||||
$I->seeInShellOutput('There were 3 failures');
|
||||
$I->seeInShellOutput('Fail File "not-a-file" not found');
|
||||
$I->seeInShellOutput('Fail File "not-a-dir" not found');
|
||||
$I->seeInShellOutput('Fail File "nothing" not found');
|
||||
}
|
||||
|
||||
public function runTestWithAnnotationDataprovider(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario -g dataprovider --steps');
|
||||
$I->seeInShellOutput('OK (15 tests');
|
||||
}
|
||||
|
||||
public function runFailedTestAndCheckOutput(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario FailedCept', false);
|
||||
$testPath = implode(DIRECTORY_SEPARATOR, ['tests', 'scenario', 'FailedCept.php']);
|
||||
$I->seeInShellOutput('1) FailedCept: Fail when file is not found');
|
||||
$I->seeInShellOutput('Test ' . $testPath);
|
||||
$I->seeInShellOutput('Step See file found "games.zip"');
|
||||
$I->seeInShellOutput('Fail File "games.zip" not found at ""');
|
||||
}
|
||||
|
||||
public function runTestWithCustomSetupMethod(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run powers PowerUpCest');
|
||||
$I->dontSeeInShellOutput('FAILURES');
|
||||
}
|
||||
|
||||
public function runCestWithTwoFailedTest(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run scenario PartialFailedCest', false);
|
||||
$I->seeInShellOutput('See file found "testcasetwo.txt"');
|
||||
$I->seeInShellOutput('See file found "testcasethree.txt"');
|
||||
$I->seeInShellOutput('Tests: 3,');
|
||||
$I->seeInShellOutput('Failures: 2.');
|
||||
}
|
||||
|
||||
|
||||
public function runWarningTests(CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run unit WarningTest.php', false);
|
||||
$I->seeInShellOutput('There was 1 warning');
|
||||
$I->seeInShellOutput('WarningTest::testWarningInvalidDataProvider');
|
||||
$I->seeInShellOutput('Tests: 1,');
|
||||
$I->seeInShellOutput('Warnings: 1.');
|
||||
}
|
||||
|
||||
}
|
||||
128
vendor/codeception/base/tests/cli/RunEnvironmentCest.php
vendored
Normal file
128
vendor/codeception/base/tests/cli/RunEnvironmentCest.php
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
class RunEnvironmentCest
|
||||
{
|
||||
|
||||
public function testDevEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute test in --dev environment');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run dummy --env=dev');
|
||||
$I->seeInShellOutput("OK (");
|
||||
}
|
||||
|
||||
public function testProdEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute test in non existent --prod environment');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run dummy --env=prod');
|
||||
$I->dontSeeInShellOutput("OK (");
|
||||
$I->seeInShellOutput("No tests executed");
|
||||
}
|
||||
|
||||
public function testEnvironmentParams(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute check that env params applied');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run powers PowerIsRisingCept.php --env=dev -vv --steps');
|
||||
$I->seeInShellOutput('I got the power');
|
||||
$I->seeInShellOutput("PASSED");
|
||||
$I->seeInShellOutput("OK (");
|
||||
}
|
||||
|
||||
public function testWithoutEnvironmentParams(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('execute check that env params applied');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run powers PowerIsRisingCept.php -vv --no-exit');
|
||||
$I->seeInShellOutput("I have no power");
|
||||
$I->seeInShellOutput("FAIL");
|
||||
}
|
||||
|
||||
public function runTestForSpecificEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run powers MageGuildCest.php --env whisky');
|
||||
$I->seeInShellOutput('MageGuildCest: Red label');
|
||||
$I->seeInShellOutput('MageGuildCest: Black label');
|
||||
$I->seeInShellOutput('MageGuildCest: Power of the universe');
|
||||
$I->seeInShellOutput('OK (3 tests, 3 assertions)');
|
||||
}
|
||||
|
||||
public function runTestForNotIncludedEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run powers MageGuildCest.php --env dev');
|
||||
$I->seeInShellOutput('MageGuildCest: Power of the universe');
|
||||
$I->seeInShellOutput('OK (1 test, 1 assertion)');
|
||||
}
|
||||
|
||||
public function testEnvFileLoading(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('test that env configuration files are loaded correctly');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env2');
|
||||
$I->seeInShellOutput('message1: MESSAGE1 FROM ENV2-DIST.');
|
||||
$I->seeInShellOutput('message2: MESSAGE2 FROM ENV2.');
|
||||
$I->seeInShellOutput('message3: MESSAGE3 FROM SUITE.');
|
||||
$I->seeInShellOutput('message4: DEFAULT MESSAGE4.');
|
||||
}
|
||||
|
||||
public function testEnvMerging(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('test that given environments are merged properly');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env1,env2');
|
||||
$I->seeInShellOutput('message1: MESSAGE1 FROM ENV2-DIST.');
|
||||
$I->seeInShellOutput('message4: MESSAGE4 FROM SUITE-ENV1.');
|
||||
$I->executeCommand('run messages MessageCest.php:allMessages -vv --env env2,env1');
|
||||
$I->seeInShellOutput('message1: MESSAGE1 FROM SUITE-ENV1.');
|
||||
$I->seeInShellOutput('message4: MESSAGE4 FROM SUITE-ENV1.');
|
||||
}
|
||||
|
||||
public function runTestForMultipleEnvironments(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('check that multiple required environments are taken into account');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env1');
|
||||
$I->dontSeeInShellOutput('Multiple env given');
|
||||
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env2');
|
||||
$I->dontSeeInShellOutput('Multiple env given');
|
||||
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env1,env2');
|
||||
$I->seeInShellOutput('Multiple env given');
|
||||
$I->executeCommand('run messages MessageCest.php:multipleEnvRequired -vv --env env2,env1');
|
||||
$I->seeInShellOutput('Multiple env given');
|
||||
}
|
||||
|
||||
public function generateEnvConfig(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('g:env firefox');
|
||||
$I->seeInShellOutput('firefox config was created');
|
||||
$I->seeFileFound('tests/_envs/firefox.yml');
|
||||
}
|
||||
|
||||
public function runEnvironmentForCept(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run messages --env email');
|
||||
$I->seeInShellOutput('Test emails');
|
||||
$I->dontSeeInShellOutput('Multiple env given');
|
||||
$I->executeCommand('run messages --env env1');
|
||||
$I->dontSeeInShellOutput('Test emails');
|
||||
}
|
||||
|
||||
public function showExceptionForUnconfiguredEnvironment(CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run skipped NoEnvironmentCept --no-exit');
|
||||
$I->seeInShellOutput("Environment nothing was not configured but used");
|
||||
$I->seeInShellOutput('WARNING');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
7
vendor/codeception/base/tests/cli/RunIncompleteCept.php
vendored
Normal file
7
vendor/codeception/base/tests/cli/RunIncompleteCept.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?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!');
|
||||
16
vendor/codeception/base/tests/cli/RunSingleTestWithIncludeCest.php
vendored
Normal file
16
vendor/codeception/base/tests/cli/RunSingleTestWithIncludeCest.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
class RunSingleTestWithIncludeCest
|
||||
{
|
||||
public function run(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/single_test_with_include');
|
||||
$I->wantTo('execute one test with include in config');
|
||||
|
||||
$I->executeCommand('run unit/ExampleCest.php');
|
||||
|
||||
$I->seeResultCodeIs(0);
|
||||
$I->dontSeeInShellOutput('RuntimeException');
|
||||
$I->dontSeeInShellOutput('could not be found');
|
||||
}
|
||||
}
|
||||
8
vendor/codeception/base/tests/cli/RunSkippedCept.php
vendored
Normal file
8
vendor/codeception/base/tests/cli/RunSkippedCept.php
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
$I = new CliGuy($scenario);
|
||||
$I->wantTo('run skipped test');
|
||||
$I->amInPath('tests/data/sandbox');
|
||||
$I->executeCommand('run skipped SkipMeCept.php');
|
||||
$I->seeInShellOutput("S SkipMeCept: Skip it");
|
||||
$I->seeInShellOutput('OK, but incomplete, skipped, or risky tests!');
|
||||
$I->seeInShellOutput('run with `-v` to get more info');
|
||||
28
vendor/codeception/base/tests/cli/SecondTestIsExecutedWhenTheFirstTestFailsCest.php
vendored
Normal file
28
vendor/codeception/base/tests/cli/SecondTestIsExecutedWhenTheFirstTestFailsCest.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
class SecondTestIsExecutedWhenTheFirstTestFailsCest
|
||||
{
|
||||
public function testIsExecuted(CliGuy $I)
|
||||
{
|
||||
$I->wantTo('see that the second test is executed');
|
||||
$I->amInPath('tests/data/first_test_fails');
|
||||
$I->executeFailCommand('run --xml --no-ansi');
|
||||
$I->seeInShellOutput('Tests: 2, Assertions: 1, Errors: 1');
|
||||
$I->seeInShellOutput('E twoTestsCest: Failing');
|
||||
$I->seeInShellOutput('+ twoTestsCest: Successful');
|
||||
}
|
||||
|
||||
public function endTestEventIsEmitted(CliGuy $I)
|
||||
{
|
||||
if (\PHPUnit\Runner\Version::series() >= 7) {
|
||||
throw new \Codeception\Exception\Skip('Not for PHPUnit 7');
|
||||
}
|
||||
$I->wantTo('see that all start and end events are emitted');
|
||||
$I->amInPath('tests/data/first_test_fails');
|
||||
$I->executeFailCommand('run --xml --no-ansi --report -o "reporters: report: CustomReporter"');
|
||||
$I->seeInShellOutput('STARTED: twoTestsCest: Failing');
|
||||
$I->seeInShellOutput('ENDED: twoTestsCest: Failing');
|
||||
$I->seeInShellOutput('STARTED: twoTestsCest: Successful');
|
||||
$I->seeInShellOutput('ENDED: twoTestsCest: Successful');
|
||||
}
|
||||
}
|
||||
19
vendor/codeception/base/tests/cli/UnitCept.php
vendored
Normal file
19
vendor/codeception/base/tests/cli/UnitCept.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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"');
|
||||
if (!class_exists('PHPUnit_Framework_ExpectationFailedException')) {
|
||||
$I->seeInThisFile('<failure type="PHPUnit\Framework\ExpectationFailedException">FailingTest::testMe');
|
||||
} else {
|
||||
$I->seeInThisFile('<failure type="PHPUnit_Framework_ExpectationFailedException">FailingTest::testMe');
|
||||
}
|
||||
34
vendor/codeception/base/tests/cli/WildcardIncludeCest.php
vendored
Normal file
34
vendor/codeception/base/tests/cli/WildcardIncludeCest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class WildcardIncludeCest
|
||||
{
|
||||
/**
|
||||
* @after checkAllSuitesExecuted
|
||||
* @param CliGuy $I
|
||||
*/
|
||||
public function runIncludedSuites(\CliGuy $I)
|
||||
{
|
||||
$I->amInPath('tests/data/included_w');
|
||||
$I->executeCommand('run');
|
||||
}
|
||||
|
||||
/**
|
||||
* @after checkAllSuitesExecuted
|
||||
* @param \CliGuy $I
|
||||
*/
|
||||
public function runIncludedSuiteFromCurrentDir(\CliGuy $I)
|
||||
{
|
||||
$I->executeCommand('run -c tests/data/included_w');
|
||||
}
|
||||
|
||||
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]');
|
||||
}
|
||||
}
|
||||
2
vendor/codeception/base/tests/cli/_bootstrap.php
vendored
Normal file
2
vendor/codeception/base/tests/cli/_bootstrap.php
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
\Codeception\Util\Autoload::addNamespace('CliGuy', __DIR__.DIRECTORY_SEPARATOR.'_steps');
|
||||
19
vendor/codeception/base/tests/cli/_steps/GeneratorSteps.php
vendored
Normal file
19
vendor/codeception/base/tests/cli/_steps/GeneratorSteps.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace CliGuy;
|
||||
|
||||
class GeneratorSteps extends \CliGuy
|
||||
{
|
||||
public function seeFileWithGeneratedClass($class, $path = '')
|
||||
{
|
||||
$I = $this;
|
||||
$I->seeFileFound($class.'.php', $path);
|
||||
$I->seeInThisFile('class '.$class);
|
||||
}
|
||||
|
||||
public function seeAutoloaderWasAdded($prefix, $path)
|
||||
{
|
||||
$I = $this;
|
||||
$I->seeFileFound('_bootstrap.php', $path);
|
||||
$I->seeInThisFile("\\Codeception\\Util\\Autoload::addNamespace('$prefix', __DIR__.DIRECTORY_SEPARATOR.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user