class FakeAutoloader

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

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

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 Unregisters this instance as an autoloader.

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