function CaptchaAdminTestCase::testCaptchaPlacementCacheClearing in CAPTCHA 7
Test the CAPTCHA placement clearing.
File
- ./
captcha.test, line 624 - Tests for CAPTCHA module.
Class
Code
function testCaptchaPlacementCacheClearing() {
// Set CAPTCHA on user register form.
captcha_set_form_id_setting('user_register_form', 'captcha/Math');
// Visit user register form to fill the CAPTCHA placement cache.
$this
->drupalGet('user/register');
// Check if there is CAPTCHA placement cache.
$placement_map = variable_get('captcha_placement_map_cache', NULL);
$this
->assertNotNull($placement_map, 'CAPTCHA placement cache should be set.');
// Clear the cache
$this
->drupalLogin($this->admin_user);
$this
->drupalPost(self::CAPTCHA_ADMIN_PATH, array(), t('Clear the CAPTCHA placement cache'));
// Check that the placement cache is unset
$placement_map = variable_get('captcha_placement_map_cache', NULL);
$this
->assertNull($placement_map, 'CAPTCHA placement cache should be unset after cache clear.');
}