You are here

function XAutoloadUnitTestCase::setUp in X Autoload 7.4

Same name and namespace in other branches
  1. 7.5 lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php \Drupal\xautoload\Tests\XAutoloadUnitTestCase::setUp()
  2. 7.3 lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php \Drupal\xautoload\Tests\XAutoloadUnitTestCase::setUp()

File

lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php, line 21

Class

XAutoloadUnitTestCase

Namespace

Drupal\xautoload\Tests

Code

function setUp() {

  // drupal_load('module', 'xautoload') would register namespaces for all
  // enabled modules, which is not intended for this unit test.
  // Instead, we just include xautoload.early.inc.
  require_once dirname(__FILE__) . '/../../../../xautoload.early.inc';

  // Make sure we use the regular loader, not the APC one.
  // Also make sure to prepend this one. Otherwise, the core class loader will
  // try to load xautoload-related stuff, e.g. xautoload_Mock_* stuff, and
  // will fail due to the database.
  foreach (spl_autoload_functions() as $callback) {
    if (is_array($callback) && ($loader = $callback[0]) && $loader instanceof ClassLoaderInterface) {
      $loader
        ->unregister();
    }
  }
  xautoload()->finder
    ->register(TRUE);

  // Do the regular setUp().
  parent::setUp();
}