From 8918a8115e95e42f25ad3e409094aa6c8b67bbb7 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Wed, 13 Apr 2016 10:34:03 +0800 Subject: [PATCH] MDL-53796 behat: Move get_debug_text to base class --- lib/behat/behat_base.php | 13 +++++++++++++ lib/tests/behat/behat_hooks.php | 13 ------------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index 7c372c68c8b..6c8b5de0dd6 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -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. * diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index f537cbeb04c..c2a9862d141 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -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 *