123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <?php
- class DataProviderFailuresAndExceptionsCest
- {
-
- protected function moveToPath(\CliGuy $I)
- {
- $I->amInPath('tests/data/dataprovider_failures_and_exceptions');
- }
-
- public function runTestWithDataProvidersFailureStdout(\CliGuy $I)
- {
-
- $devNull = (DIRECTORY_SEPARATOR === '\\')?'NUL':'/dev/null';
- $I->executeCommand('run -n -v unit DataProvidersFailureCest 2> '.$devNull,false);
-
- $I->canSeeShellOutputMatches('/^Codeception PHP Testing Framework v[0-9\.]+\nPowered by PHPUnit .+ by Sebastian Bergmann and contributors\./');
- $I->seeResultCodeIs(1);
- }
-
- 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.');
-
- $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.');
-
- $I->dontSeeInShellOutput('Exception trace');
- $I->seeResultCodeIs(1);
- }
-
- 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.');
-
- $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.');
-
- $I->seeInShellOutput('[Codeception\Exception\TestParseException]');
- $I->seeInShellOutput('Exception trace');
- $I->seeResultCodeIs(1);
- }
-
- public function runTestWithDataProvidersExceptionStdout(\CliGuy $I)
- {
-
- $devNull = (DIRECTORY_SEPARATOR === '\\')?'NUL':'/dev/null';
- $I->executeCommand('run -n unit DataProvidersExceptionCest -v 2> '.$devNull, false);
-
- $I->canSeeShellOutputMatches('/^Codeception PHP Testing Framework v[0-9\.]+\nPowered by PHPUnit .+ by Sebastian Bergmann and contributors\./');
- $I->seeResultCodeIs(1);
- }
-
- public function runTestWithDataProvidersExceptionStderr(\CliGuy $I)
- {
- $I->executeCommand('run -n unit DataProvidersExceptionCest 2>&1', false);
-
- $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');
-
- $I->dontSeeInShellOutput('[Codeception\Exception\TestParseException]');
- $I->dontSeeInShellOutput('Couldn\'t parse test');
- $I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle ');
-
- $I->seeInShellOutput('Something went wrong!!!');
-
- $I->dontSeeInShellOutput('Exception trace:');
- $I->seeResultCodeIs(1);
- }
-
- public function runTestWithDataProvidersExceptionStderrVerbose(\CliGuy $I)
- {
- $I->executeCommand('run -n unit DataProvidersExceptionCest -v 2>&1', false);
-
- $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');
-
- $I->dontSeeInShellOutput('[Codeception\Exception\TestParseException]');
- $I->dontSeeInShellOutput('Couldn\'t parse test');
- $I->dontSeeInShellOutput('DataProvider \'rectangle\' for DataProvidersFailureCest->testIsTriangle is ');
-
- $I->seeInShellOutput('Something went wrong!!!');
-
- $I->seeInShellOutput('[Exception]');
- $I->seeInShellOutput('Exception trace:');
- $I->seeResultCodeIs(1);
- }
- }
|