Skip to content

Instantly share code, notes, and snippets.

@dmonllao
Created February 17, 2014 03:53
Show Gist options
  • Select an option

  • Save dmonllao/9044460 to your computer and use it in GitHub Desktop.

Select an option

Save dmonllao/9044460 to your computer and use it in GitHub Desktop.
Patch for Moodle 2.5 to output the DOM status in the CLI when a scenario fails
From 328f9f77ed72186419f1abc56c1baccf268153fb Mon Sep 17 00:00:00 2001
From: David Monllao <[email protected]>
Date: Mon, 17 Feb 2014 11:52:20 +0800
Subject: [PATCH] For Moodle 2.5 - Output the DOM in the CLI window
---
lib/tests/behat/behat_hooks.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php
index 4881a30..77064b5 100644
--- a/lib/tests/behat/behat_hooks.php
+++ b/lib/tests/behat/behat_hooks.php
@@ -247,6 +247,17 @@ class behat_hooks extends behat_base {
}
/**
+ * Outputs the failed steps HTML code
+ *
+ * @AfterStep
+ */
+ public function after_step($event) {
+ if ($event->getResult() == StepEvent::FAILED) {
+ echo PHP_EOL . PHP_EOL . $this->getSession()->getPage()->getContent() . PHP_EOL . PHP_EOL;
+ }
+ }
+
+ /**
* Internal step definition to find exceptions, debugging() messages and PHP debug messages.
*
* Part of behat_hooks class as is part of the testing framework, is auto-executed
--
1.8.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment