src/Services/BootstrapDrupal.php
public function run()
    {
        // Don't bootstrap twice in runtime
        if (static::$bootstrapped) {
            return;
        }

        // Read environment variables to set drupal root
        $this->readEnvironmentFile();

        // Set the base url if provided in environment
        $this->setBaseURL();

        // Read environment variables
        if (! defined('DRUPAL_ROOT')) {
            define('DRUPAL_ROOT', $this->getDrupalRoot());
        }

        if (empty(DRUPAL_ROOT)) {
            throw new TripalTestSuiteException('DRUPAL_ROOT is not configured correctly. Please use .env files to set DRUPAL_ROOT.');
        }

        require_once DRUPAL_ROOT.'/includes/bootstrap.inc';
        $_SERVER['REMOTE_ADDR'] = '127.0.0.1';

        $cwd = getcwd();
        chdir(DRUPAL_ROOT);
        // The bootstrap function won't run twice since drupal checks if it has run it before
        drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
        chdir($cwd);

        static::$bootstrapped = true;
    }
public function run()
    {
        // Don't bootstrap twice in runtime
        if (static::$bootstrapped) {
            return;
        }

        // Read environment variables to set drupal root
        $this->readEnvironmentFile();

        // Set the base url if provided in environment
        $this->setBaseURL();

        // Read environment variables
        if (! defined('DRUPAL_ROOT')) {
            define('DRUPAL_ROOT', $this->getDrupalRoot());
        }

        if (empty(DRUPAL_ROOT)) {
            throw new TripalTestSuiteException('DRUPAL_ROOT is not configured correctly. Please use .env files to set DRUPAL_ROOT.');
        }

        require_once DRUPAL_ROOT.'/includes/bootstrap.inc';
        $_SERVER['REMOTE_ADDR'] = '127.0.0.1';

        $cwd = getcwd();
        chdir(DRUPAL_ROOT);
        // The bootstrap function won't run twice since drupal checks if it has run it before
        drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
        chdir($cwd);

        static::$bootstrapped = true;
    }
Bootstrap Drupal.

@throws \Statonlab\TripalTestSuite\Exceptions\TripalTestSuiteException