You are here

class FakeAutoloader in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\FakeAutoloader
  2. 9 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\FakeAutoloader

A fake autoloader for testing.

Hierarchy

Expanded class hierarchy of FakeAutoloader

File

core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php, line 144

Namespace

Drupal\Tests\Core\DrupalKernel
View source
class FakeAutoloader {

  /**
   * Registers this instance as an autoloader.
   *
   * @param bool $prepend
   *   Whether to prepend the autoloader or not
   */
  public function register($prepend = FALSE) {
    spl_autoload_register([
      $this,
      'loadClass',
    ], TRUE, $prepend);
  }

  /**
   * Unregisters this instance as an autoloader.
   */
  public function unregister() {
    spl_autoload_unregister([
      $this,
      'loadClass',
    ]);
  }

  /**
   * Loads the given class or interface.
   *
   * @return null
   *   This class never loads.
   */
  public function loadClass() {
    return NULL;
  }

  /**
   * Finds a file by class name while caching lookups to APC.
   *
   * @return null
   *   This class never finds.
   */
  public function findFile() {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FakeAutoloader::findFile public function Finds a file by class name while caching lookups to APC.
FakeAutoloader::loadClass public function Loads the given class or interface.
FakeAutoloader::register public function Registers this instance as an autoloader.
FakeAutoloader::unregister public function Unregisters this instance as an autoloader.