MDL-53796 behat: Move get_debug_text to base class

This commit is contained in:
David Monllao 2016-04-13 10:34:03 +08:00
parent b611ade3ab
commit 8918a8115e
2 changed files with 13 additions and 13 deletions

View File

@ -804,6 +804,19 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
}
}
/**
* Converts HTML tags to line breaks to display the info in CLI
*
* @param string $html
* @return string
*/
protected function get_debug_text($html) {
// Replacing HTML tags for new lines and keeping only the text.
$notags = preg_replace('/<+\s*\/*\s*([A-Z][A-Z0-9]*)\b[^>]*\/*\s*>*/i', "\n", $html);
return preg_replace("/(\n)+/s", "\n", $notags);
}
/**
* Helper function to execute api in a given context.
*

View File

@ -504,19 +504,6 @@ class behat_hooks extends behat_base {
$this->look_for_exceptions();
}
/**
* Converts HTML tags to line breaks to display the info in CLI
*
* @param string $html
* @return string
*/
protected function get_debug_text($html) {
// Replacing HTML tags for new lines and keeping only the text.
$notags = preg_replace('/<+\s*\/*\s*([A-Z][A-Z0-9]*)\b[^>]*\/*\s*>*/i', "\n", $html);
return preg_replace("/(\n)+/s", "\n", $notags);
}
/**
* Returns whether the first scenario of the suite is running
*