GherkinCest.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * @group gherkin
  4. */
  5. class GherkinCest
  6. {
  7. public function _before(CliGuy $I)
  8. {
  9. $I->amInPath('tests/data/sandbox');
  10. }
  11. public function steps(CliGuy $I)
  12. {
  13. $I->executeCommand('gherkin:steps scenario');
  14. $I->seeInShellOutput('I have terminal opened');
  15. $I->seeInShellOutput('ScenarioGuy::terminal');
  16. $I->seeInShellOutput('there is a file :name');
  17. $I->seeInShellOutput('I see file :name');
  18. $I->seeInShellOutput('ScenarioGuy::matchFile');
  19. }
  20. public function snippets(CliGuy $I)
  21. {
  22. $I->executeCommand('gherkin:snippets scenario');
  23. $I->seeInShellOutput('@Given I have only idea of what\'s going on here');
  24. $I->seeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
  25. }
  26. public function snippetsScenarioFile(CliGuy $I)
  27. {
  28. $I->executeCommand('gherkin:snippets scenario FileExamples.feature');
  29. $I->dontSeeInShellOutput('@Given I have only idea of what\'s going on here');
  30. $I->dontSeeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
  31. }
  32. public function snippetsScenarioFolder(CliGuy $I)
  33. {
  34. $I->executeCommand('gherkin:snippets scenario subfolder');
  35. $I->seeInShellOutput('Given I have a feature in a subfolder');
  36. $I->seeInShellOutput('public function iHaveAFeatureInASubfolder');
  37. $I->dontSeeInShellOutput('@Given I have only idea of what\'s going on here');
  38. $I->dontSeeInShellOutput('public function iHaveOnlyIdeaOfWhatsGoingOnHere');
  39. }
  40. public function snippetsPyStringArgument(CliGuy $I)
  41. {
  42. $I->executeCommand('gherkin:snippets scenario PyStringArgumentExample.feature');
  43. $I->seeInShellOutput('@Given I have PyString argument :arg1');
  44. $I->seeInShellOutput('public function iHavePyStringArgument($arg1)');
  45. $I->dontSeeInShellOutput('public function iSeeOutput($arg1)');
  46. }
  47. public function runIncompletedStepWithPyStringArgument(CliGuy $I)
  48. {
  49. $I->executeCommand('run scenario "PyStringArgumentExample.feature:PyString argument" --steps');
  50. $I->seeInShellOutput('Step definition for `I have PyString argument ""` not found in contexts');
  51. $I->dontSeeInShellOutput('Step definition for `I see output` not found in contexts');
  52. }
  53. public function runSameStepWithInlineAndPyStringArgument(CliGuy $I)
  54. {
  55. $I->executeCommand('run scenario "InlineArgumentExample.feature:Running step with inline argument" --steps');
  56. $I->seeInShellOutput("Argument: test");
  57. $I->executeCommand('run scenario "PyStringArgumentExample.feature:Running step with PyString argument" --steps');
  58. $I->seeInShellOutput("Argument: First line\nSecond line");
  59. }
  60. public function snippetsScenarioUtf8(CliGuy $I)
  61. {
  62. $I->executeCommand('gherkin:snippets scenario Utf8Example.feature');
  63. $I->seeInShellOutput('@Given я написал сценарий на языке :arg1');
  64. $I->seeInShellOutput('public function step_62e20dc62($arg1)');
  65. }
  66. }