public function useTheMirrorDirShortcut(CliGuy $I) { $I->wantTo('mirror dir with _mirrorDir shortcut'); $I->shortcutMirrorDir('box', 'bin'); $I->seeDirFound('bin'); $I->seeFileFound('robo.txt', 'bin'); }
protected function checkCompatFilesCreated(\CliGuy $I) { $I->seeDirFound('tests/_log'); $I->seeDirFound('tests/_data'); $I->seeDirFound('tests/_helpers'); $I->seeFileFound('functional.suite.yml', 'tests'); $I->seeFileFound('acceptance.suite.yml', 'tests'); $I->seeFileFound('unit.suite.yml', 'tests'); $I->seeFileFound('_bootstrap.php', 'tests/acceptance'); $I->seeFileFound('_bootstrap.php', 'tests/functional'); $I->seeFileFound('_bootstrap.php', 'tests/unit'); $I->seeFileFound('WebGuy.php', 'tests/acceptance'); $I->seeFileFound('TestGuy.php', 'tests/functional'); $I->seeFileFound('CodeGuy.php', 'tests/unit'); $I->seeFileFound('WebHelper.php', 'tests/_helpers'); $I->seeFileFound('TestHelper.php', 'tests/_helpers'); $I->seeFileFound('CodeHelper.php', 'tests/_helpers'); }
protected function checkFilesCreated(\CliGuy $I) { $I->seeDirFound('tests/_support'); $I->seeDirFound('tests/_data'); $I->seeDirFound('tests/_output'); $I->seeDirFound('tests/_envs'); $I->seeFileFound('functional.suite.yml', 'tests'); $I->seeFileFound('acceptance.suite.yml', 'tests'); $I->seeFileFound('unit.suite.yml', 'tests'); $I->seeFileFound('_bootstrap.php', 'tests/acceptance'); $I->seeFileFound('_bootstrap.php', 'tests/functional'); $I->seeFileFound('_bootstrap.php', 'tests/unit'); $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'); }
<?php $I = new CliGuy($scenario); $I->wantTo('flatten dir with FlattenDir task'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->taskFlattenDir(['some/deeply/nested/*.re' => 'flattened', '*.txt' => 'flattened'])->run(); $I->seeDirFound('flattened'); $I->seeFileFound('structu.re', 'flattened'); $I->seeFileFound('a.txt', 'flattened'); $I->seeFileFound('b.txt', 'flattened');
<?php $I = new CliGuy($scenario); $I->wantTo('copy dir with CopyDir task'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->taskCopyDir(['box' => 'bin'])->run(); $I->seeDirFound('bin'); $I->seeFileFound('robo.txt', 'bin');
<?php $I = new CliGuy($scenario); $I->wantTo('copy dir recursively with CopyDir task'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->seeDirFound('some/deeply/nested'); $I->seeFileFound('structu.re', 'some/deeply/nested'); $I->taskCopyDir(['some/deeply' => 'some_destination/deeply'])->run(); $I->seeDirFound('some_destination/deeply/nested'); $I->seeFileFound('structu.re', 'some_destination/deeply/nested');
<?php $I = new CliGuy($scenario); $I->wantTo('archive directory and then extract it again with Archive and Extract tasks'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->seeDirFound('some/deeply/nested'); $I->seeFileFound('structu.re', 'some/deeply/nested'); $I->seeFileFound('existing_file', 'some/deeply'); // Test a bunch of archive types that we support foreach (['zip', 'tar', 'tar.gz', 'tar.bz2', 'tgz'] as $archiveType) { // First, take everything from the folder 'some/deeply' and make // an archive for it located in 'deep' $I->taskPack("deeply.{$archiveType}")->add(['deep' => 'some/deeply'])->run(); $I->seeFileFound("deeply.{$archiveType}"); // We are next going to extract the archive we created, this time // putting it into a folder called "extracted-$archiveType" (different // for each archive type we test). We rely on the default behavior // of our extractor to remove the top-level directory in the archive // ("deeply"). $I->taskExtract("deeply.{$archiveType}")->to("extracted-{$archiveType}")->preserveTopDirectory(false)->run(); $I->seeDirFound("extracted-{$archiveType}"); $I->seeDirFound("extracted-{$archiveType}/nested"); $I->seeFileFound('structu.re', "extracted-{$archiveType}/nested"); // Next, we'll extract the same archive again, this time preserving // the top-level folder. $I->taskExtract("deeply.{$archiveType}")->to("preserved-{$archiveType}")->preserveTopDirectory()->run(); $I->seeDirFound("preserved-{$archiveType}"); $I->seeDirFound("preserved-{$archiveType}/deep/nested"); $I->seeFileFound('structu.re', "preserved-{$archiveType}/deep/nested"); // Make another archive, this time composed of fanciful locations $I->taskPack("composed.{$archiveType}")->add(['a/b/existing_file' => 'some/deeply/existing_file'])->add(['x/y/z/structu.re' => 'some/deeply/nested/structu.re'])->run();
<?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('flatten dir with FlattenDir task including parents'); $I->amInPath(codecept_data_dir() . 'sandbox'); $I->taskFlattenDir('some/deeply/nested/*.re')->includeParents(array(1, 1))->parentDir('some')->to('flattened')->run(); $I->seeDirFound('flattened/deeply/nested'); $I->seeFileFound('structu.re', 'flattened/deeply/nested');