public function TermstatusAdminTestCase::testPerVocabularyDefaults in Taxonomy Term Status 7
Test alterations of vocabulary edit form.
File
- ./
termstatus.test, line 164 - Tests for termstatus.module
Class
- TermstatusAdminTestCase
- Tests the administrative user interface.
Code
public function testPerVocabularyDefaults() {
$admin = $this
->drupalCreateUser(array(
'administer taxonomy',
));
$this
->drupalLogin($admin);
// Test default behavior (default: published).
variable_del('termstatus_default_tags');
$this
->drupalGet('admin/structure/taxonomy/tags/edit');
$this
->assertFieldChecked('edit-termstatus-default-status', 'Default publishing status should be enabled by default.');
$this
->drupalGet('admin/structure/taxonomy/tags/add');
$this
->assertFieldChecked('edit-status', 'Publishing status on term should be checked.');
// Set default to published.
$edit = array(
'termstatus_default_status' => TRUE,
);
$this
->drupalPost('admin/structure/taxonomy/tags/edit', $edit, t('Save'));
$this
->assertEqual(1, variable_get('termstatus_default_tags'), 'Default publishing status for vocabulary should be saved in the proper variable when enabled.');
$this
->drupalGet('admin/structure/taxonomy/tags/add');
$this
->assertFieldChecked('edit-status', 'Publishing status on term should be checked.');
// Set default to unpublished.
$edit = array(
'termstatus_default_status' => FALSE,
);
$this
->drupalPost('admin/structure/taxonomy/tags/edit', $edit, t('Save'));
$this
->assertEqual(0, variable_get('termstatus_default_tags'), 'Default publishing status for vocabulary should be saved in the proper variable when disabled.');
$this
->drupalGet('admin/structure/taxonomy/tags/add');
$this
->assertNoFieldChecked('edit-status', 'Publishing status on term should not be checked.');
}