function simpletest_classloader_register

Registers namespaces for disabled modules.

4 calls to simpletest_classloader_register()
SimpletestResultsForm::buildForm in drupal/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestResultsForm.php
Form constructor.
SimpletestTestForm::submitForm in drupal/core/modules/simpletest/lib/Drupal/simpletest/Form/SimpletestTestForm.php
Form submission handler.
simpletest_test_get_all in drupal/core/modules/simpletest/simpletest.module
Get a list of all of the tests provided by the system.
_simpletest_batch_operation in drupal/core/modules/simpletest/simpletest.module
Batch operation callback.

File

drupal/core/modules/simpletest/simpletest.module, line 511
Provides testing functionality.

Code

function simpletest_classloader_register() {

  // @see drupal_get_filename()
  $types = array(
    'theme_engine' => array(
      'dir' => 'themes/engines',
      'extension' => 'engine',
    ),
    'module' => array(
      'dir' => 'modules',
      'extension' => 'module',
    ),
    'theme' => array(
      'dir' => 'themes',
      'extension' => 'info',
    ),
    'profile' => array(
      'dir' => 'profiles',
      'extension' => 'profile',
    ),
  );
  foreach ($types as $type => $info) {
    $matches = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\\.' . $info['extension'] . '$/', $info['dir']);
    foreach ($matches as $name => $file) {
      drupal_classloader_register($name, dirname($file->uri));
      drupal_classloader()
        ->addPrefix('Drupal\\' . $name . '\\Tests', DRUPAL_ROOT . '/' . dirname($file->uri) . '/tests');

      // While being there, prime drupal_get_filename().
      drupal_get_filename($type, $name, $file->uri);
    }
  }

  // Register the core test directory so we can find Drupal\UnitTestCase.
  drupal_classloader()
    ->addPrefix('Drupal\\Tests', DRUPAL_ROOT . '/core/tests');

  // Manually register phpunit prefixes because they use a classmap instead of a
  // prefix. This can be safely removed if we move to using composer's
  // autoloader with a classmap.
  drupal_classloader()
    ->addPrefixes(array(
    'PHPUnit' => DRUPAL_ROOT . '/core/vendor/phpunit/phpunit',
    'File_Iterator' => DRUPAL_ROOT . '/core/vendor/phpunit/php-file-iterator/',
    'PHP_Timer' => DRUPAL_ROOT . '/core/vendor/phpunit/php-timer/',
  ));
}