<?php

use Drupal\xautoload\Tests\EnvironmentSnapshotMaker;

xautoload()->registerModulePsr4(__FILE__, 'lib');

/**
 * Implements hook_boot()
 *
 * This turns xautoload_test_2 into a boot module.
 */
function xautoload_test_3_boot() {
  _xautoload_test_3_early_boot_observations('boot');
}

_xautoload_test_3_early_boot_observations('early');

/**
 * Test the current state, and remember it.
 */
function _xautoload_test_3_early_boot_observations($phase = NULL) {
  EnvironmentSnapshotMaker::takeSnapshot(
    'xautoload_test_3',
    $phase,
    array('Drupal\xautoload_test_3\ExampleClass'));
}

/**
 * Implements hook_menu()
 */
function xautoload_test_3_menu() {
  return array(
    'xautoload_test_3.json' => array(
      'page callback' => '_xautoload_test_3_json',
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
    ),
  );
}

/**
 * Page callback for "xautoload-example/json"
 */
function _xautoload_test_3_json() {
  $all = EnvironmentSnapshotMaker::getSnapshots('xautoload_test_3');
  drupal_json_output($all);
  exit();
}
