BootstrapCest.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. class BootstrapCest
  3. {
  4. protected $bootstrapPath;
  5. public function _before(\CliGuy $I)
  6. {
  7. $this->bootstrapPath = 'tests/data/sandbox/boot'.uniqid();
  8. @mkdir($this->bootstrapPath, 0777, true);
  9. $I->amInPath($this->bootstrapPath);
  10. }
  11. public function bootstrap(\CliGuy $I)
  12. {
  13. $I->executeCommand('bootstrap');
  14. $I->seeFileFound('codeception.yml');
  15. $this->checkFilesCreated($I);
  16. }
  17. public function bootstrapWithNamespace(\CliGuy $I)
  18. {
  19. $I->executeCommand('bootstrap --namespace Generated');
  20. $I->seeFileFound('codeception.yml');
  21. $I->seeInThisFile('namespace: Generated');
  22. $I->dontSeeInThisFile('namespace Generated\\');
  23. $this->checkFilesCreated($I);
  24. $I->seeFileFound('Acceptance.php', 'tests/_support/Helper');
  25. $I->seeInThisFile('namespace Generated\Helper;');
  26. $I->seeFileFound('AcceptanceTester.php', 'tests/_support');
  27. $I->seeInThisFile('namespace Generated;');
  28. }
  29. public function bootstrapWithNamespaceShortcut(\CliGuy $I)
  30. {
  31. $I->executeCommand('bootstrap -s Generated');
  32. $I->seeFileFound('codeception.yml');
  33. $I->seeInThisFile('namespace: Generated');
  34. $I->dontSeeInThisFile('namespace Generated\\');
  35. $this->checkFilesCreated($I);
  36. $I->seeFileFound('Acceptance.php', 'tests/_support/Helper');
  37. $I->seeInThisFile('namespace Generated\Helper;');
  38. $I->seeFileFound('AcceptanceTester.php', 'tests/_support');
  39. $I->seeInThisFile('namespace Generated;');
  40. }
  41. public function bootstrapWithActor(\CliGuy $I)
  42. {
  43. $I->executeCommand('bootstrap --actor Ninja');
  44. $I->seeFileFound('AcceptanceNinja.php', 'tests/_support/');
  45. }
  46. public function bootstrapEmpty(\CliGuy $I)
  47. {
  48. $I->executeCommand('bootstrap --empty');
  49. $I->dontSeeFileFound('tests/acceptance');
  50. $I->seeFileFound('codeception.yml');
  51. }
  52. public function bootstrapFromInit(\CliGuy $I)
  53. {
  54. $I->executeCommand('init bootstrap');
  55. $this->checkFilesCreated($I);
  56. }
  57. public function bootstrapFromInitUsingClassName(\CliGuy $I)
  58. {
  59. $I->executeCommand('init "Codeception\Template\Bootstrap"');
  60. $this->checkFilesCreated($I);
  61. }
  62. protected function checkFilesCreated(\CliGuy $I)
  63. {
  64. $I->seeDirFound('tests/_support');
  65. $I->seeDirFound('tests/_data');
  66. $I->seeDirFound('tests/_output');
  67. $I->seeFileFound('functional.suite.yml', 'tests');
  68. $I->seeFileFound('acceptance.suite.yml', 'tests');
  69. $I->seeFileFound('unit.suite.yml', 'tests');
  70. $I->seeFileFound('AcceptanceTester.php', 'tests/_support');
  71. $I->seeFileFound('FunctionalTester.php', 'tests/_support');
  72. $I->seeFileFound('UnitTester.php', 'tests/_support');
  73. $I->seeFileFound('Acceptance.php', 'tests/_support/Helper');
  74. $I->seeFileFound('Functional.php', 'tests/_support/Helper');
  75. $I->seeFileFound('Unit.php', 'tests/_support/Helper');
  76. }
  77. }