boot.test 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Perform early bootstrap tests.
  4. */
  5. class EarlyBootstrapTestCase extends DrupalWebTestCase {
  6. public static function getInfo() {
  7. return array(
  8. 'name' => 'Early bootstrap test',
  9. 'description' => 'Confirm that calling module_implements() during early bootstrap does not pollute the module_implements() cache.',
  10. 'group' => 'System',
  11. );
  12. }
  13. function setUp() {
  14. parent::setUp('boot_test_1', 'boot_test_2');
  15. }
  16. /**
  17. * Test hook_boot() on both regular and "early exit" pages.
  18. */
  19. public function testHookBoot() {
  20. $paths = array('', 'early_exit');
  21. foreach ($paths as $path) {
  22. // Empty the module_implements() caches.
  23. module_implements(NULL, FALSE, TRUE);
  24. // Do a request to the front page, which will call module_implements()
  25. // during hook_boot().
  26. $this->drupalGet($path);
  27. // Reset the static cache so we get implementation data from the persistent
  28. // cache.
  29. drupal_static_reset();
  30. // Make sure we get a full list of all modules implementing hook_help().
  31. $modules = module_implements('help');
  32. $this->assertTrue(in_array('boot_test_2', $modules));
  33. }
  34. }
  35. }