function ClassLoaderTest::testClassLoading

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

See also

\Drupal\module_autoload_test\SomeClass

File

drupal/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php, line 35
Definition of Drupal\system\Tests\Module\ClassLoaderTest.

Class

ClassLoaderTest
Tests class loading.

Namespace

Drupal\system\Tests\Module

Code

function testClassLoading() {

  // Enable the module_test and module_autoload_test modules.
  module_enable(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.');
  }
}