You are here

function ModuleUnitTest::testModuleImplements in SimpleTest 7

Test module_implements() caching.

File

tests/module.test, line 87
Tests for the module API.

Class

ModuleUnitTest
Unit tests for the module API.

Code

function testModuleImplements() {

  // Clear the cache.
  cache_clear_all('module_implements', 'cache');
  $this
    ->assertFalse(cache_get('module_implements'), t('The module implements cache is empty.'));
  $this
    ->drupalGet('');
  $this
    ->assertTrue(cache_get('module_implements'), t('The module implements cache is populated after requesting a page.'));

  // Test again with an authenticated user.
  $this->user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($this->user);
  cache_clear_all('module_implements', 'cache');
  $this
    ->drupalGet('');
  $this
    ->assertTrue(cache_get('module_implements'), t('The module implements cache is populated after requesting a page.'));
}