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