Advertisement
UniQuet0p1

test

Oct 10th, 2021
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. <?php
  2.  
  3. require_once 'vendor/php-test-framework/public-api.php';
  4.  
  5. const BASE_URL = 'http://localhost:8080';
  6.  
  7. function _submittingFormAddsPersonToList() {
  8. gotoLandingPage();
  9.  
  10. clickBookFormLink();
  11.  
  12. $book = getSampleBook();
  13.  
  14. setTextFieldValue('title', $book->title);
  15. setRadioFieldValue('grade', $book->grade);
  16. setCheckboxValue('isRead', $book->isRead);
  17.  
  18. clickBookFormSubmitButton();
  19.  
  20. assertPageContainsText($book->title);
  21. }
  22.  
  23. function submittingAuthorFormAddsAuthorToList() {
  24. gotoLandingPage();
  25.  
  26. clickAuthorFormLink();
  27.  
  28. $author = getSampleAuthor();
  29.  
  30. setTextFieldValue('firstName', $author->firstName);
  31. setTextFieldValue('lastName', $author->lastName);
  32. setRadioFieldValue('grade', $author->grade);
  33.  
  34. clickAuthorFormSubmitButton();
  35.  
  36. assertPageContainsText($author->firstName);
  37. assertPageContainsText($author->lastName);
  38. }
  39.  
  40. function canHandleDifferentSymbolsInBookTitles() {
  41.  
  42. gotoLandingPage();
  43.  
  44. clickBookFormLink();
  45.  
  46. $title = "!.,:;\n" . getSampleBook()->title;
  47.  
  48. setTextFieldValue('title', $title);
  49.  
  50. clickBookFormSubmitButton();
  51.  
  52. assertPageContainsText($title);
  53. }
  54.  
  55. function canHandleDifferentSymbolsInAuthorNames() {
  56.  
  57. gotoLandingPage();
  58.  
  59. clickAuthorFormLink();
  60.  
  61. $firstName = "!.,:;\n" . getSampleAuthor()->firstName;
  62. $lastName = "!.,:;\n" . getSampleAuthor()->lastName;
  63.  
  64. setTextFieldValue('firstName', $firstName);
  65. setTextFieldValue('lastName', $lastName);
  66.  
  67. clickAuthorFormSubmitButton();
  68.  
  69. assertPageContainsText($firstName);
  70. assertPageContainsText($lastName);
  71. }
  72.  
  73. setBaseUrl(BASE_URL);
  74. setLogRequests(false);
  75. setLogPostParameters(false);
  76. setPrintStackTrace(false);
  77. setPrintPageSourceOnError(false);
  78.  
  79. stf\runTests(new stf\PointsReporter([4 => 5]));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement