protected static function Redis_Tests_AbstractUnitTestCase::enableAutoload in Redis 7.3
Same name and namespace in other branches
- 7.2 lib/Redis/Tests/AbstractUnitTestCase.php \Redis_Tests_AbstractUnitTestCase::enableAutoload()
Enable the autoloader
This exists in this class in case the autoloader is not set into the settings.php file or another way
Return value
void|boolean
1 call to Redis_Tests_AbstractUnitTestCase::enableAutoload()
- Redis_Tests_AbstractUnitTestCase::setUp in lib/
Redis/ Tests/ AbstractUnitTestCase.php - Sets up unit test environment.
File
- lib/
Redis/ Tests/ AbstractUnitTestCase.php, line 18
Class
Code
protected static function enableAutoload() {
if (self::$loaderEnabled) {
return;
}
if (class_exists('Redis_Client')) {
return;
}
spl_autoload_register(function ($className) {
$parts = explode('_', $className);
if ('Redis' === $parts[0]) {
$filename = __DIR__ . '/../lib/' . implode('/', $parts) . '.php';
return (bool) (include_once $filename);
}
return false;
}, null, true);
self::$loaderEnabled = true;
}