function CoderUpgradeWebTestCase::checkSettingsInterface in Coder 7
Same name and namespace in other branches
- 7.2 coder_upgrade/coder_upgrade.test \CoderUpgradeWebTestCase::checkSettingsInterface()
Test the settings via the user interface.
1 call to CoderUpgradeWebTestCase::checkSettingsInterface()
- CoderUpgradeWebTestCase::testAdminInterface in coder_upgrade/
coder_upgrade.test - Call test methods (prefixed with 'check' to avoid setUp overhead).
File
- coder_upgrade/
coder_upgrade.test, line 268
Class
- CoderUpgradeWebTestCase
- Functional tests for the admin interface (settings and execution).
Code
function checkSettingsInterface() {
// Visit the advanced menu settings page.
$this
->drupalGet('admin/config/development/coder_upgrade/settings');
// Update the settings.
$edit = array();
$edit['coder_upgrade_dir_old'] = $this
->randomName();
$edit['coder_upgrade_dir_new'] = $this
->randomName();
$edit['coder_upgrade_dir_patch'] = $this
->randomName();
$this
->drupalPost(NULL, $edit, t('Save configuration'));
$this
->assertRaw(t('The configuration options have been saved.'), t('Settings updated successfully'));
// Verify the settings.
$settings = variable_get('coder_upgrade_dir_old', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_old'], t('Old directory name found in variable.'));
$settings = variable_get('coder_upgrade_dir_new', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_new'], t('New directory name found in variable.'));
$settings = variable_get('coder_upgrade_dir_patch', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_patch'], t('Patch directory name found in variable.'));
// There is no reset button visible?
// Reset the settings.
$edit = array();
$edit['coder_upgrade_dir_old'] = DEADWOOD_OLD;
$edit['coder_upgrade_dir_new'] = DEADWOOD_NEW;
$edit['coder_upgrade_dir_patch'] = DEADWOOD_PATCH;
$this
->drupalPost(NULL, $edit, t('Save configuration'));
// $this->drupalPost(NULL, $edit, t('Reset to defaults'));
$this
->assertRaw(t('The configuration options have been saved.'), t('Settings updated successfully'));
// Verify the settings.
$settings = variable_get('coder_upgrade_dir_old', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_old'], t('Old directory name was cleared.'));
$settings = variable_get('coder_upgrade_dir_new', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_new'], t('New directory name was cleared.'));
$settings = variable_get('coder_upgrade_dir_patch', '');
$this
->assertEqual($settings, $edit['coder_upgrade_dir_patch'], t('Patch directory name was cleared.'));
}