Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'RandomUtil.class.php';
- use Drupal\DrupalExtension\Context\RawDrupalContext;
- use Behat\Behat\Context\SnippetAcceptingContext;
- use Behat\Gherkin\Node\PyStringNode;
- use Behat\Gherkin\Node\TableNode;
- use Behat\MinkExtension\Context\MinkRedirectContext;
- /**
- * Defines application features from the specific context.
- */
- class FeatureContext extends RawDrupalContext implements SnippetAcceptingContext {
- private $email_address;
- /**
- * Initializes context.
- *
- * Every scenario gets its own context instance.
- * You can also pass arbitrary arguments to the
- * context constructor through behat.yml.
- */
- public function __construct() {
- }
- /**
- * @When I enter a random email address into the form
- */
- public function enterEmail() {
- $random_email_address = RandomUtil::getRandomEmail();
- $this->email_address = $random_email_address;
- }
- /**
- * @Then I should see previously entered email on the thank you page.
- */
- public function checkForEmail() {
- $saved_email = $this->email_address;
- $page = $this->getSession()->getPage();
- $email_element = $page->find('css', '.email');
- $value = $email_element->getText();
- if ($value !== $saved_email) {
- throw new Exception("Email does not match expected value");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement