You are here

function AbstractDrupalBootTest::testModuleEnable in X Autoload 7.5

Tests a request where modules are enabled, but xautoload is already enabled.

@dataProvider providerModuleEnable

Parameters

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

array $expectedCalls:

Throws

\Exception

File

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

Class

AbstractDrupalBootTest
@runTestsInSeparateProcesses @preserveGlobalState disabled

Namespace

Drupal\xautoload\Tests\DrupalBootTest

Code

function testModuleEnable(array $initialModules, array $expectedCalls) {
  $this
    ->prepare();
  $this
    ->prepareInitialModules($initialModules);
  foreach ($this->exampleModules
    ->getExampleClasses() as $classes) {
    foreach ((array) $classes as $class) {
      $this
        ->assertClassIsUndefined($class);
    }
  }
  $this->exampleDrupal
    ->boot();
  $new_modules = array_keys($this->exampleModules
    ->getExampleClasses());
  $this->exampleDrupal
    ->moduleEnable($new_modules);

  # HackyLog::log($this->callLog->getCalls());
  $this->callLog
    ->assertCalls($this, $expectedCalls);

  // Now we want all classes to be available.
  foreach ($this->exampleModules
    ->getExampleClasses() as $classes) {
    foreach ((array) $classes as $class) {
      $this
        ->assertClassExists($class);
    }
  }
  $this
    ->unprepare();
}