Skip to content

Instantly share code, notes, and snippets.

@vincenzodibiaggio
Created August 16, 2013 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincenzodibiaggio/6251665 to your computer and use it in GitHub Desktop.
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
/**
* 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