You are here

private function AbstractDrupalBootTest::prepareInitialModules in X Autoload 7.5

Parameters

mixed[] $initialModules: Initial modules being installed / enabled.

Throws

\Exception

1 call to AbstractDrupalBootTest::prepareInitialModules()
AbstractDrupalBootTest::testModuleEnable in tests/src/DrupalBootTest/AbstractDrupalBootTest.php
Tests a request where modules are enabled, but xautoload is already enabled.

File

tests/src/DrupalBootTest/AbstractDrupalBootTest.php, line 147

Class

AbstractDrupalBootTest
@runTestsInSeparateProcesses @preserveGlobalState disabled

Namespace

Drupal\xautoload\Tests\DrupalBootTest

Code

private function prepareInitialModules($initialModules) {
  foreach ($initialModules as $name => $state) {
    if (TRUE === $state) {

      // Module is installed and enabled.
      $this->exampleDrupal
        ->getSystemTable()
        ->moduleSetEnabled($name);
      $this->exampleDrupal
        ->getSystemTable()
        ->moduleSetSchemaVersion($name, 7000);
    }
    elseif (FALSE === $state) {

      // Module is installed, but disabled.
      $this->exampleDrupal
        ->getSystemTable()
        ->moduleSetSchemaVersion($name, 7000);
    }
    elseif (NULL === $state) {

      // Module is neither installed nor enabled.
    }
    else {
      throw new \Exception("Unexpected state.");
    }
  }
  if (isset($initialModules['xautoload'])) {

    // xautoload is installed or enabled, so the module weight must be in the database.
    $this->exampleDrupal
      ->getSystemTable()
      ->moduleSetWeight('xautoload', -90);
  }
}