GenerateEnvironmentTest.php 970 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. require_once __DIR__ . DIRECTORY_SEPARATOR . 'BaseCommandRunner.php';
  3. class GenerateEnvironmentTest extends BaseCommandRunner
  4. {
  5. protected function setUp()
  6. {
  7. $this->makeCommand('\Codeception\Command\GenerateEnvironment');
  8. $this->config = [
  9. 'class_name' => 'HobbitGuy',
  10. 'path' => 'tests/shire',
  11. 'paths' => ['envs' => 'tests/_envs','tests' => 'tests'],
  12. ];
  13. }
  14. public function testCreated()
  15. {
  16. $this->execute(['env' => 'firefox']);
  17. $this->assertContains('firefox config was created in tests/_envs/firefox.yml', $this->output);
  18. $this->assertEquals('tests/_envs/firefox.yml', $this->filename);
  19. }
  20. public function testFailed()
  21. {
  22. $this->makeCommand('\Codeception\Command\GenerateEnvironment', false);
  23. $this->execute(['env' => 'firefox']);
  24. $this->assertContains('File tests/_envs/firefox.yml already exists', $this->output);
  25. }
  26. }