| 7 filter.test | FilterSecurityTestCase::testDisableFilterModule() |
| 8 filter.test | FilterSecurityTestCase::testDisableFilterModule() |
Test that filtered content is emptied when an actively used filter module is disabled.
File
- modules/
filter/ filter.test, line 762 - Tests for filter.module.
Code
function testDisableFilterModule() {
// Create a new node.
$node = $this->drupalCreateNode(array('promote' => 1));
$body_raw = $node->body[LANGUAGE_NONE][0]['value'];
$format_id = $node->body[LANGUAGE_NONE][0]['format'];
$this->drupalGet('node/' . $node->nid);
$this->assertText($body_raw, t('Node body found.'));
// Enable the filter_test_replace filter.
$edit = array(
'filters[filter_test_replace][status]' => 1,
);
$this->drupalPost('admin/config/content/formats/' . $format_id, $edit, t('Save configuration'));
// Verify that filter_test_replace filter replaced the content.
$this->drupalGet('node/' . $node->nid);
$this->assertNoText($body_raw, t('Node body not found.'));
$this->assertText('Filter: Testing filter', t('Testing filter output found.'));
// Disable the text format entirely.
$this->drupalPost('admin/config/content/formats/' . $format_id . '/disable', array(), t('Disable'));
// Verify that the content is empty, because the text format does not exist.
$this->drupalGet('node/' . $node->nid);
$this->assertNoText($body_raw, t('Node body not found.'));
}
Login or register to post comments