MDL-53796 behat: Move get_debug_text to base class

This commit is contained in:
David Monllao
2016-04-13 10:37:10 +08:00
parent 98eb681cc0
commit 256cd103ba
2 changed files with 13 additions and 13 deletions
+13
View File
@@ -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.
*
-13
View File
@@ -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
*