Created
August 16, 2013 17:07
-
-
Save vincenzodibiaggio/6251665 to your computer and use it in GitHub Desktop.
Useful snipset to manage Drupal redirection/page refresh on form submit (user creation/update, etc..) in a Behat's scenario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Useful snipset to manage Drupal redirection/page refresh on form submit (user creation/update, etc..) in a Behat's scenario | |
* | |
* Is not mine, I have found in Drupal site, but I don't remember where | |
*/ | |
/** | |
* @Given /^I follow meta refresh$/ | |
*/ | |
public function iFollowMetaRefresh() { | |
while ($refresh = $this->getMainContext()->getSession()->getPage()->find('css', 'meta[http-equiv="Refresh"]')) { | |
$content = $refresh->getAttribute('content'); | |
$url = str_replace('0; URL=', '', $content); | |
$this->getMainContext()->getSession()->visit($url); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment