mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
MDL-53796 behat: Move get_debug_text to base class
This commit is contained in:
parent
b611ade3ab
commit
8918a8115e
@ -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.
|
||||
*
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user