/** * @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">'); }
/** * @group reports * @param CliGuy $I */ public function runXmlReport(\CliGuy $I) { $I->wantTo('check xml reports'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('run dummy --xml'); $I->seeFileFound('report.xml', 'tests/_log'); $I->seeInThisFile('<?xml'); $I->seeInThisFile('<testsuite name="dummy"'); $I->seeInThisFile('<testcase file="FileExistsCept.php"'); }
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 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 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;'); }
public function bootstrapWithNamespace(\CliGuy $I) { $I->executeCommand('bootstrap --namespace Generated'); $I->seeInShellOutput('Building Actor classes for suites'); $I->seeFileFound('codeception.yml'); $I->seeInThisFile('namespace: Generated'); $I->dontSeeInThisFile('namespace Generated\\'); $this->checkFilesCreated($I); $I->seeFileFound('Acceptance.php', 'tests/_support/Helper'); $I->seeInThisFile('namespace Generated\\Helper;'); $I->seeFileFound('AcceptanceTester.php', 'tests/_support'); $I->seeInThisFile('namespace Generated;'); }
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;'); }
<?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->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 xml reports for unit tests'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('run unit --xml --no-exit'); $I->seeFileFound('report.xml','tests/_log'); $I->seeInThisFile('<?xml'); $I->seeInThisFile('<testsuite name="unit" tests="5" assertions="5" failures="2" errors="0"'); $I->seeInThisFile('<testcase name="testMe" class="PassingTest"'); $I->seeInThisFile('<testcase name="testIsTriangle with data set #0" assertions="1"'); $I->seeInThisFile('<testcase name="testOne" class="DependsTest"'); $I->seeInThisFile('<failure type="PHPUnit_Framework_ExpectationFailedException">test one');
<?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');
<?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->wantToTest('build command'); $I->runShellCommmand('php codecept build'); $I->seeInShellOutput('generated sucessfully'); $I->seeFileFound('TestGuy.php', 'tests/functional'); $I->seeFileFound('CodeGuy.php', 'tests/unit'); $I->seeFileFound('CliGuy.php', 'tests/acceptance'); $I->seeInThisFile('seeFileFound(');
<?php $I = new CliGuy($scenario); $I->wantTo('check tap reports'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('run --tap'); $I->seeFileFound('report.tap.log', 'tests/_log'); $I->seeInThisFile('ok 1 - check config exists');
<?php $I = new CliGuy($scenario); $I->wantTo('generate sample Test'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('generate:test dummy Dummy'); $I->seeFileFound('DummyTest.php'); $I->seeInThisFile('class DummyTest extends \\Codeception\\TestCase\\Test'); $I->seeInThisFile('protected $dumbGuy'); $I->seeInThisFile("function _before(");
<?php $I = new CliGuy($scenario); $I->wantTo('overwrite a file with CopyDir task'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->seeDirFound('some'); $I->seeFileFound('existing_file', 'some'); $I->taskCopyDir(['some' => 'some_destination'])->run(); $I->seeFileFound('existing_file', 'some_destination/deeply'); $I->openFile('some_destination/deeply/existing_file'); $I->seeInThisFile('some existing file');
<?php $I = new CliGuy($scenario); $I->wantTo('generate sample Cest'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('generate:cest dummy DummyClass'); $I->seeFileFound('DummyClassCest.php'); $I->seeInThisFile("\$class = 'DummyClass'"); $I->seeInThisFile("public function helloWorld");
<?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->seeInThisFile("I WANT TO CHECK CONFIG EXISTS"); $I->seeInThisFile('I see file found "codeception.yml"');
<?php $I = new CliGuy($scenario); $I->wantTo('check xml reports'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('run --xml'); $I->seeFileFound('report.xml', 'tests/_log'); $I->seeInThisFile('<?xml'); $I->seeInThisFile('<testsuite name="dummy"'); $I->seeInThisFile('<testcase file="FileExistsCept.php"');
<?php $scenario->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(');
<?php $I = new CliGuy($scenario); $I->wantTo('generate sample Test'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('generate:phpunit dummy Dummy'); $I->seeFileFound('DummyTest.php'); $I->seeInThisFile('class DummyTest extends \\PHPUnit_Framework_TestCase'); $I->seeInThisFile('function setUp()');
<?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');
<?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');
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('generate sample Cest'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('generate:cest dummy DummyClass'); $I->seeFileFound('DummyClassCest.php'); $I->seeInThisFile('class DummyClassCest');
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)'); }
<?php $I = new CliGuy($scenario); $I->wantTo('add namespace to configuration'); $I->amInPath('tests/data/sandbox'); $I->executeCommand('refactor:add-namespace Jazz --force'); $I->seeFileFound('codeception.yml'); $I->seeInThisFile('namespace: Jazz'); $I->seeFileFound('OrderHelper.php'); $I->seeInThisFile('namespace Jazz\\Codeception\\Module;'); $I->seeFileFound('FileExistsCept.php'); $I->seeInThisFile('use Jazz\\Codeception\\DumbGuy;');