IncludedCest.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. class IncludedCest
  3. {
  4. public function _before()
  5. {
  6. \Codeception\Util\FileSystem::doEmptyDir('tests/data/included/_log');
  7. file_put_contents('tests/data/included/_log/.gitkeep', '');
  8. }
  9. /**
  10. * @param CliGuy $I
  11. */
  12. protected function moveToIncluded(\CliGuy $I)
  13. {
  14. $I->amInPath('tests/data/included');
  15. }
  16. /**
  17. * @before moveToIncluded
  18. * @param CliGuy $I
  19. */
  20. public function runSuitesFromIncludedConfigs(\CliGuy $I)
  21. {
  22. $I->executeCommand('run');
  23. $I->seeInShellOutput('[Jazz]');
  24. $I->seeInShellOutput('Jazz.functional Tests');
  25. $I->seeInShellOutput('[Jazz\Pianist]');
  26. $I->seeInShellOutput('Jazz\Pianist.functional Tests');
  27. $I->seeInShellOutput('[Shire]');
  28. $I->seeInShellOutput('Shire.functional Tests');
  29. }
  30. /**
  31. * @before moveToIncluded
  32. * @param CliGuy $I
  33. */
  34. public function runIncludedWithXmlOutput(\CliGuy $I)
  35. {
  36. $I->executeCommand('run --xml');
  37. $I->amInPath('_log');
  38. $I->seeFileFound('report.xml');
  39. $I->seeInThisFile('<testsuite name="Jazz.functional" tests="1" assertions="1"');
  40. $I->seeInThisFile('<testsuite name="Jazz\Pianist.functional" tests="1" assertions="1"');
  41. $I->seeInThisFile('<testsuite name="Shire.functional" tests="1" assertions="1"');
  42. $I->seeInThisFile('<testcase name="Hobbit"');
  43. $I->seeInThisFile('<testcase name="Demo"');
  44. $I->seeInThisFile('<testcase name="Pianist"');
  45. }
  46. /**
  47. * @before moveToIncluded
  48. * @param CliGuy $I
  49. */
  50. public function runIncludedWithHtmlOutput(\CliGuy $I)
  51. {
  52. $I->executeCommand('run --html');
  53. $I->amInPath('_log');
  54. $I->seeFileFound('report.html');
  55. $I->seeInThisFile('Codeception Results');
  56. $I->seeInThisFile('Jazz.functional Tests');
  57. $I->seeInThisFile('Check that jazz musicians can add numbers');
  58. $I->seeInThisFile('Jazz\Pianist.functional Tests');
  59. $I->seeInThisFile('Check that jazz pianists can add numbers');
  60. $I->seeInThisFile('Shire.functional Tests');
  61. }
  62. /**
  63. * @before moveToIncluded
  64. * @group coverage
  65. * @param CliGuy $I
  66. */
  67. public function runIncludedWithCoverage(\CliGuy $I)
  68. {
  69. $I->executeCommand('run --coverage-xml');
  70. $I->amInPath('_log');
  71. $I->seeFileFound('coverage.xml');
  72. $I->seeInThisFile('<class name="BillEvans" namespace="Jazz\Pianist">');
  73. $I->seeInThisFile('<class name="Musician" namespace="Jazz">');
  74. $I->seeInThisFile('<class name="Hobbit" namespace="Shire">');
  75. }
  76. /**
  77. * @before moveToIncluded
  78. * @param CliGuy $I
  79. */
  80. public function buildIncluded(\CliGuy $I)
  81. {
  82. $I->executeCommand('build');
  83. $I->seeInShellOutput('generated successfully');
  84. $I->seeInShellOutput('Jazz\\TestGuy');
  85. $I->seeInShellOutput('Jazz\\Pianist\\TestGuy');
  86. $I->seeInShellOutput('Shire\\TestGuy');
  87. }
  88. }