You are here

function ClassLoaderTest::testClassLoading in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Module/ClassLoaderTest.php \Drupal\system\Tests\Module\ClassLoaderTest::testClassLoading()

Tests that module-provided classes can be loaded when a module is enabled.

See also

\Drupal\module_autoload_test\SomeClass

File

core/modules/system/src/Tests/Module/ClassLoaderTest.php, line 29
Contains \Drupal\system\Tests\Module\ClassLoaderTest.

Class

ClassLoaderTest
Tests class loading for modules.

Namespace

Drupal\system\Tests\Module

Code

function testClassLoading() {

  // Enable the module_test and module_autoload_test modules.
  \Drupal::service('module_installer')
    ->install(array(
    'module_test',
    'module_autoload_test',
  ), FALSE);
  $this
    ->resetAll();

  // Check twice to test an unprimed and primed system_list() cache.
  for ($i = 0; $i < 2; $i++) {
    $this
      ->drupalGet('module-test/class-loading');
    $this
      ->assertText($this->expected, 'Autoloader loads classes from an enabled module.');
  }
}