You are here

function _xautoload_test_1_early_boot_observations in X Autoload 7.3

Same name and namespace in other branches
  1. 7.5 tests/test_1/xautoload_test_1.module \_xautoload_test_1_early_boot_observations()
  2. 7.4 tests/test_1/xautoload_test_1.module \_xautoload_test_1_early_boot_observations()

Test the current state, and remember it.

2 calls to _xautoload_test_1_early_boot_observations()
xautoload_test_1_boot in tests/test_1/xautoload_test_1.module
Implements hook_boot()
_xautoload_test_1_json in tests/test_1/xautoload_test_1.module
Page callback for "xautoload-example/json"

File

tests/test_1/xautoload_test_1.module, line 17

Code

function _xautoload_test_1_early_boot_observations($phase = NULL) {
  static $all = array();
  if (!isset($phase)) {
    $return = $all;
    foreach ($return as $phase => &$observations) {

      // Turn callbacks into strings, so they survive json_decode().
      foreach ($observations['spl_autoload_functions'] as &$callback) {

        // At this point in time we can be fairly sure
        // that xautoload_Util is available.
        $callback = xautoload_Util::callbackToString($callback);
      }
    }
    return $return;
  }

  // Test that all classes are available immediately at boot time.
  foreach (array(
    'Drupal\\xautoload_test_1\\ExampleClass',
    'xautoload_test_1_ExampleClass',
  ) as $class) {
    $observations[$class] = class_exists($class);
  }

  // Check variable_get().
  $observations['xautoload_cache_mode'] = variable_get('xautoload_cache_mode');
  $observations['db_connection_info'] = Database::getConnectionInfo();
  $observations['spl_autoload_functions'] = spl_autoload_functions();
  $all[$phase] = $observations;
}