MDL-55879 behat: Only hook BeforeSuite once
authorRajesh Taneja <rajesh@moodle.com>
Wed, 7 Sep 2016 06:24:09 +0000 (14:24 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Wed, 7 Sep 2016 06:24:09 +0000 (14:24 +0800)
Before suite check and initialise behat env,
this is valid for the whole run, so no need
to do the inilialsation again

lib/tests/behat/behat_hooks.php

index 5398e0a..5a713c6 100644 (file)
@@ -111,6 +111,11 @@ class behat_hooks extends behat_base {
      * @BeforeSuite
      */
     public static function before_suite_hook(BeforeSuiteScope $scope) {
+        // If behat has been initialised then no need to do this again.
+        if (self::$initprocessesfinished) {
+            return;
+        }
+
         try {
             self::before_suite($scope);
         } catch (behat_stop_exception $e) {