class FakeAutoloader

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\FakeAutoloader
  2. 8.9.x core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\FakeAutoloader
  3. 11.x 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 172

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);
    }
    
    /**
     * Deregisters this instance as an autoloader.
     */
    public function unregister() {
        spl_autoload_unregister([
            $this,
            'loadClass',
        ]);
    }
    
    /**
     * Loads the given class or interface.
     *
     * This class never loads.
     */
    public function loadClass() {
        return NULL;
    }
    
    /**
     * Finds a file by class name while caching lookups to APC.
     *
     * This class never finds.
     */
    public function findFile() {
        return NULL;
    }

}

Members

Title Sort descending Modifiers Object type Summary
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 Deregisters this instance as an autoloader.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.