Browse Source

Fix bootstrap path error

Abdullah Almsaeed 7 years ago
parent
commit
b358db3093
1 changed files with 12 additions and 3 deletions
  1. 12 3
      test/bootstrap.php

+ 12 - 3
test/bootstrap.php

@@ -1,15 +1,24 @@
 <?php
+// Set environment variables
 test_suite_read_and_set_environment_variables();
+
+// Get Drupal root path
 $drupal_root = getenv('DRUPAL_ROOT');
-define('DRUPAL_ROOT', $drupal_root ?: __DIR__.'/../../../../..');
+define('DRUPAL_ROOT', $drupal_root ?: '/var/www/html');
+
+// Get Drupal bootstrap functions
 require_once DRUPAL_ROOT.'/includes/bootstrap.inc';
 $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
+
+// Bootstrap Drupal.
 $current_dir = getcwd();
 chdir(DRUPAL_ROOT);
-// Bootstrap Drupal.
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
 chdir($current_dir);
+
 /**
+ * Get and set environment variables from .env file if it exists.
+ *
  * @throws \Exception
  */
 function test_suite_read_and_set_environment_variables() {
@@ -27,4 +36,4 @@ function test_suite_read_and_set_environment_variables() {
     }
     fclose($file);
   }
-}
+}