MDL-53796 behat: Move get_debug_text to base class
This commit is contained in:
@@ -773,6 +773,19 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
// If we were interacting with a popup window it will not exists after closing it.
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
@@ -511,19 +511,6 @@ class behat_hooks extends behat_base {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user