You are here

function XAutoloadUnitTestCase::testAutoloadStackOrder in X Autoload 7.3

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

File

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

Class

XAutoloadUnitTestCase

Namespace

Drupal\xautoload\Tests

Code

function testAutoloadStackOrder() {
  $expected = array(
    'xautoload_ClassLoader_NoCache->loadClass()',
    'drupal_autoload_class',
    'drupal_autoload_interface',
    '_simpletest_autoload_psr0',
  );
  $msg = 'spl_autoload_functions():';
  foreach (spl_autoload_functions() as $index => $callback) {
    $str = $this
      ->callbackToString($callback);
    if (!isset($expected[$index])) {
      $this
        ->fail("Autoload callback at index {$index} must be empty instead of {$str}.");
    }
    else {
      $expected_str = $expected[$index];
      if ($expected_str === $str) {
        $this
          ->pass("Autoload callback at index {$index} must be {$expected_str}.");
      }
      else {
        $this
          ->fail("Autoload callback at index {$index} must be {$expected_str} instead of {$str}.");
      }
    }
  }
}