芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/vendor/codeception/codeception/src/Codeception/Template/Bootstrap.php
checkInstalled($this->workDir); $input = $this->input; if ($input->getOption('namespace')) { $this->namespace = trim($input->getOption('namespace'), '\\') . '\\'; } if ($input->hasOption('actor') && $input->getOption('actor')) { $this->actorSuffix = $input->getOption('actor'); } $this->say( "
Bootstrapping Codeception
\n" ); $this->createGlobalConfig(); $this->say("File codeception.yml created <- global configuration"); $this->createDirs(); if ($input->hasOption('empty') && $input->getOption('empty')) { return; } if (!class_exists('\\Codeception\\Module\\Asserts') || !class_exists('\\Codeception\\Module\\PhpBrowser')) { $this->addModulesToComposer(['PhpBrowser', 'Asserts']); } $this->createUnitSuite(); $this->createFunctionalSuite(); $this->createAcceptanceSuite(); $this->say(" --- "); $this->say(); $this->saySuccess('Codeception is installed for acceptance, functional, and unit testing'); $this->say(); $this->say("
Next steps:
"); $this->say('1. Edit
tests/acceptance.suite.yml
to set url of your application. Change PhpBrowser to WebDriver to enable browser testing'); $this->say("2. Edit
tests/functional.suite.yml
to enable a framework module. Remove this file if you don't use a framework"); $this->say("3. Create your first acceptance tests using
codecept g:cest acceptance First
"); $this->say("4. Write first test in
tests/acceptance/FirstCest.php
"); $this->say("5. Run tests using:
codecept run
"); } protected function createDirs() { $this->createDirectoryFor('tests'); $this->createEmptyDirectory($this->outputDir); $this->createEmptyDirectory($this->dataDir); $this->createDirectoryFor($this->supportDir . DIRECTORY_SEPARATOR . '_generated'); $this->createDirectoryFor($this->supportDir . DIRECTORY_SEPARATOR . "Helper"); $this->gitIgnore('tests/_output'); $this->gitIgnore('tests/_support/_generated'); } protected function createFunctionalSuite($actor = 'Functional') { $suiteConfig = <<
actorSuffix} modules: enabled: # add a framework module here - \\{$this->namespace}Helper\Functional step_decorators: ~ EOF; $this->createSuite('functional', $actor, $suiteConfig); $this->say("tests/functional created <- functional tests"); $this->say("tests/functional.suite.yml written <- functional tests suite configuration"); } protected function createAcceptanceSuite($actor = 'Acceptance') { $suiteConfig = <<
actorSuffix} modules: enabled: - PhpBrowser: url: http://localhost/myapp - \\{$this->namespace}Helper\Acceptance step_decorators: ~ EOF; $this->createSuite('acceptance', $actor, $suiteConfig); $this->say("tests/acceptance created <- acceptance tests"); $this->say("tests/acceptance.suite.yml written <- acceptance tests suite configuration"); } protected function createUnitSuite($actor = 'Unit') { $suiteConfig = <<
actorSuffix} modules: enabled: - Asserts - \\{$this->namespace}Helper\Unit step_decorators: ~ EOF; $this->createSuite('unit', $actor, $suiteConfig); $this->say("tests/unit created <- unit tests"); $this->say("tests/unit.suite.yml written <- unit tests suite configuration"); } public function createGlobalConfig() { $basicConfig = [ 'paths' => [ 'tests' => 'tests', 'output' => $this->outputDir, 'data' => $this->dataDir, 'support' => $this->supportDir, 'envs' => $this->envsDir, ], 'actor_suffix' => 'Tester', 'extensions' => [ 'enabled' => ['Codeception\Extension\RunFailed'] ] ]; $str = Yaml::dump($basicConfig, 4); if ($this->namespace) { $namespace = rtrim($this->namespace, '\\'); $str = "namespace: $namespace\n" . $str; } $this->createFile('codeception.yml', $str); } protected function createSuite($suite, $actor, $config) { $this->createDirectoryFor("tests/$suite", "$suite.suite.yml"); $this->createHelper($actor, $this->supportDir); $this->createActor($actor . $this->actorSuffix, $this->supportDir, Yaml::parse($config)); $this->createFile('tests' . DIRECTORY_SEPARATOR . "$suite.suite.yml", $config); } }