OrderCest.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <?php
  2. class OrderCest
  3. {
  4. public function checkOneFile(CliGuy $I)
  5. {
  6. $I->amInPath('tests/data/sandbox');
  7. $I->executeCommand('run order LoadingOrderCept.php');
  8. $I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap(B), test(T), after, afterSuite');
  9. $I->seeFileFound('order.txt', 'tests/_output');
  10. $I->seeFileContentsEqual("BIB([ST])");
  11. }
  12. public function checkForFails(CliGuy $I)
  13. {
  14. $I->amInPath('tests/data/sandbox');
  15. $I->executeCommand('run order FailedCept.php --no-exit');
  16. $I->seeFileFound('order.txt', 'tests/_output');
  17. $I->expect('global bootstrap, initialization, beforeSuite, before, bootstrap, test, fail, after, afterSuite');
  18. $I->seeFileContentsEqual("BIB([STF])");
  19. }
  20. public function checkForCanCantFails(CliGuy $I)
  21. {
  22. $I->amInPath('tests/data/sandbox');
  23. $I->executeCommand('run order CanCantFailCept.php --no-exit');
  24. $I->seeFileFound('order.txt', 'tests/_output');
  25. $I->expect(
  26. 'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
  27. . ' fail, fail, test, after, afterSuite'
  28. );
  29. $I->seeFileContentsEqual("BIB([STFFT])");
  30. }
  31. public function checkForCanCantFailsInCest(CliGuy $I)
  32. {
  33. $I->amInPath('tests/data/sandbox');
  34. $I->executeCommand('run order CanCantFailCest.php --no-exit');
  35. $I->seeFileFound('order.txt', 'tests/_output');
  36. $I->expect(
  37. 'global bootstrap, initialization, beforeSuite, before, bootstrap, test,'
  38. . ' fail, fail, test, test, fail, fail, test, after, afterSuite'
  39. );
  40. $I->seeFileContentsEqual("BIB([TFT][TFT])");
  41. }
  42. public function checkSimpleFiles(CliGuy $I)
  43. {
  44. $I->amInPath('tests/data/sandbox');
  45. $I->executeCommand('run order --no-exit --group simple');
  46. $I->seeFileFound('order.txt', 'tests/_output');
  47. $I->seeFileContentsEqual("BIBP({{{{[ST][STFFT][STF][ST]}}}})");
  48. }
  49. public function checkCestOrder(CliGuy $I)
  50. {
  51. $I->amInPath('tests/data/sandbox');
  52. $I->executeCommand('run tests/order/ReorderCest.php --no-exit');
  53. $I->seeFileFound('order.txt', 'tests/_output');
  54. $I->seeFileContentsEqual("BIB([0123456])");
  55. }
  56. public function checkFailingCestOrder(CliGuy $I)
  57. {
  58. $I->amInPath('tests/data/sandbox');
  59. $I->executeCommand('run tests/order/FailedCest.php --no-exit -vvv');
  60. $I->seeFileFound('order.txt', 'tests/_output');
  61. $I->seeFileContentsEqual("BIB([a%F])");
  62. }
  63. public function checkCodeceptionTest(CliGuy $I)
  64. {
  65. $I->amInPath('tests/data/sandbox');
  66. $I->executeCommand('run order CodeTest.php --no-exit');
  67. $I->seeFileFound('order.txt', 'tests/_output');
  68. $I->expect('
  69. global bootstrap,
  70. initialization,
  71. beforeSuite,
  72. beforeClass,
  73. @beforeClass,
  74. bootstrap,
  75. before,
  76. @before
  77. test,
  78. after,
  79. @after,
  80. afterSuite,
  81. afterClass,
  82. @afterClass');
  83. $I->seeFileContentsEqual("BIB({{[<C>]}})");
  84. }
  85. public function checkAfterBeforeClassInTests(CliGuy $I)
  86. {
  87. $I->amInPath('tests/data/sandbox');
  88. $I->executeCommand('run order BeforeAfterClassTest.php');
  89. $I->seeFileFound('order.txt', 'tests/_output');
  90. $I->seeInThisFile('BIB({[1][2]})');
  91. }
  92. public function checkAfterBeforeClassInTestWithDataProvider(CliGuy $I)
  93. {
  94. $I->amInPath('tests/data/sandbox');
  95. $I->executeCommand('run order BeforeAfterClassWithDataProviderTest.php');
  96. $I->seeFileFound('order.txt', 'tests/_output');
  97. $I->seeInThisFile('BIB({[A][B][C]})');
  98. }
  99. public function checkBootstrapIsLoadedBeforeTests(CliGuy $I)
  100. {
  101. $I->amInPath('tests/data/sandbox');
  102. $I->executeCommand('run order ParsedLoadedTest.php');
  103. $I->seeFileFound('order.txt', 'tests/_output');
  104. $I->seeInThisFile('BIBP(T)');
  105. }
  106. }