drupal_yext-8.x-1.0/phpunit-autoload.php
phpunit-autoload.php
<?php
/**
* @file
* PHPUnit class autoloader.
*
* PHPUnit knows nothing about Drupal, so provide PHPUnit with the bare
* minimum it needs to know in order to find classes by namespace.
*
* Used by the PHPUnit test runner and referenced in ./phpunit.xml.
*/
spl_autoload_register(function ($class) {
$custom_code = [
'drupal_yext' => '.',
'drupal_yext_find_by_title' => './modules/drupal_yext_find_by_title',
'drupal_yext_sync_deleted' => './modules/drupal_yext_sync_deleted',
];
require_once 'phpunit-bootstrap.php';
foreach ($custom_code as $namespace => $dir) {
if (substr($class, 0, strlen('Drupal\\' . $namespace . '\\')) == 'Drupal\\' . $namespace . '\\') {
$class2 = preg_replace('/^Drupal\\\\' . $namespace . '\\\\/', '', $class);
$path = $dir . '/src/' . str_replace('\\', '/', $class2) . '.php';
require_once $path;
}
}
});
