You are here

protected function XAutoloadWebTestCase::xautoloadModuleEnabled in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php \Drupal\xautoload\Tests\XAutoloadWebTestCase::xautoloadModuleEnabled()
  2. 7.3 lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php \Drupal\xautoload\Tests\XAutoloadWebTestCase::xautoloadModuleEnabled()

Parameters

string $module:

string[] $classes:

bool $classes_on_include:

1 call to XAutoloadWebTestCase::xautoloadModuleEnabled()
XAutoloadWebTestCase::xautoloadTestWithCacheTypes in lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php

File

lib/Drupal/xautoload/Tests/XAutoloadWebTestCase.php, line 85

Class

XAutoloadWebTestCase

Namespace

Drupal\xautoload\Tests

Code

protected function xautoloadModuleEnabled($module, $classes, $classes_on_include) {
  EnvironmentSnapshotMaker::takeSnapshot($module, 'later', $classes);
  $all = EnvironmentSnapshotMaker::getSnapshots($module);
  foreach ($all as $phase => $observations) {
    $when = $phase === 'early' ? 'on drupal_load() during module_enable()' : ($phase === 'later' ? 'after hook_modules_enabled()' : 'at an undefined time');

    // Test the classes of the example module.
    foreach ($classes as $class) {

      // Test that the class was already found in $phase.
      $this
        ->assertTrue(isset($observations['class_exists'][$class]), "Class {$class} was checked {$when}.");
      if ($classes_on_include || $phase !== 'early') {
        $this
          ->assertTrue($observations['class_exists'][$class], "Class {$class} was found {$when}.");
      }
      else {
        $this
          ->assertFalse($observations['class_exists'][$class], "Class {$class} cannot be found {$when}.");
      }
    }
  }
}