You are here

class DrupalEnvironment in X Autoload 7.5

Hierarchy

Expanded class hierarchy of DrupalEnvironment

3 files declare their use of DrupalEnvironment
AbstractDrupalBootTest.php in tests/src/DrupalBootTest/AbstractDrupalBootTest.php
DrupalBootHookTest.php in tests/src/DrupalBootTest/DrupalBootHookTest.php
DrupalBootTest.php in tests/src/DrupalBootTest/DrupalBootTest.php

File

tests/src/VirtualDrupal/DrupalEnvironment.php, line 9

Namespace

Drupal\xautoload\Tests\VirtualDrupal
View source
class DrupalEnvironment {

  /**
   * @var self
   */
  private static $staticInstance;

  /**
   * @var DrupalComponentContainer
   */
  private $components;

  /**
   * @var ExampleModulesInterface
   */
  private $exampleModules;

  /**
   * @param ExampleModulesInterface $exampleModules
   */
  function __construct(ExampleModulesInterface $exampleModules) {
    $this->components = new DrupalComponentContainer($exampleModules);
    $this->exampleModules = $exampleModules;
  }
  function setStaticInstance() {
    self::$staticInstance = $this;
  }

  /**
   * @return DrupalEnvironment
   */
  static function getInstance() {
    return self::$staticInstance;
  }

  /**
   * @return MockDrupalSystem
   */
  function getMockDrupalSystem() {
    return $this->components->MockDrupalSystem;
  }

  /**
   * @return Cache
   */
  function getCache() {
    return $this->components->Cache;
  }

  /**
   * @return SystemTable
   */
  function getSystemTable() {
    return $this->components->SystemTable;
  }

  /**
   * Simulates Drupal's \module_enable()
   *
   * @param string[] $module_list
   *   Array of module names.
   * @param bool $enable_dependencies
   *   TRUE, if dependencies should be enabled too.
   *
   * @return bool
   */
  function moduleEnable(array $module_list, $enable_dependencies = TRUE) {
    $this->components->ModuleEnable
      ->moduleEnable($module_list, $enable_dependencies);
  }

  /**
   * Replicates the Drupal bootstrap.
   */
  public function boot() {
    $this->components->DrupalBoot
      ->boot();
  }

  /**
   * Version of systemUpdateBootstrapStatus() with no side effects.
   *
   * @see _system_update_bootstrap_status()
   */
  public function initBootstrapStatus() {
    $bootstrap_modules = $this->exampleModules
      ->getBootstrapModules();
    $this->components->SystemTable
      ->setBootstrapModules($bootstrap_modules);
  }

  /**
   * @param string $name
   *
   * @return mixed
   */
  public function librariesLoad($name) {
    return $this->components->LibrariesLoad
      ->librariesLoad($name);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DrupalEnvironment::$components private property
DrupalEnvironment::$exampleModules private property
DrupalEnvironment::$staticInstance private static property
DrupalEnvironment::boot public function Replicates the Drupal bootstrap.
DrupalEnvironment::getCache function
DrupalEnvironment::getInstance static function
DrupalEnvironment::getMockDrupalSystem function
DrupalEnvironment::getSystemTable function
DrupalEnvironment::initBootstrapStatus public function Version of systemUpdateBootstrapStatus() with no side effects.
DrupalEnvironment::librariesLoad public function
DrupalEnvironment::moduleEnable function Simulates Drupal's \module_enable()
DrupalEnvironment::setStaticInstance function
DrupalEnvironment::__construct function