public function AuthcacheTestAdminWidgets::testDurationSelectSubmit in Authenticated User Page Caching (Authcache) 7.2
Test duration select widget.
File
- tests/
authcache.widget.test, line 459 - Test cases for pluggable cache backends.
Class
- AuthcacheTestAdminWidgets
- Cover authcache module.
Code
public function testDurationSelectSubmit() {
$durations = array(
60,
3600,
);
$form = system_settings_form(array(
'authcache_test_maxage' => array(
'#title' => $this
->randomName(8),
'#description' => $this
->randomName(32),
'#type' => 'authcache_duration_select',
'#durations' => $durations,
'#default_value' => 60,
),
));
$form_stub = $this->stubmod
->hook('form', $form);
$this
->drupalGet('authcache-widget-test-form');
$this
->assertStub($form_stub, HookStub::once());
$edit = array(
'authcache_test_maxage[select]' => 3600,
);
$this
->drupalPost(NULL, $edit, t('Save configuration'));
$actual = variable_get('authcache_test_maxage');
$expect = mt_rand(1, 1000);
$edit = array(
'authcache_test_maxage[select]' => 'custom',
'authcache_test_maxage[custom]' => $expect,
);
$this
->drupalPost(NULL, $edit, t('Save configuration'));
$actual = variable_get('authcache_test_maxage');
$this
->assertEqual($expect, $actual);
}