protected function CustomFilterTest::editRule in Custom filter 8
Edit an existing rule.
1 call to CustomFilterTest::editRule()
- CustomFilterTest::testModule in src/
Tests/ CustomFilterTest.php - Run all the tests.
File
- src/
Tests/ CustomFilterTest.php, line 135
Class
- CustomFilterTest
- Test the Custom Filter administration and use.
Namespace
Drupal\customfilter\TestsCode
protected function editRule() {
$edit = array();
$edit['name'] = 'New rule label';
$edit['description'] = 'rule description';
$edit['enabled'] = TRUE;
$edit['pattern'] = '/Goodbye Drupal 7/i';
$edit['code'] = FALSE;
$edit['replacement'] = 'Come back Drupal 7';
$this
->drupalPostForm('admin/config/content/customfilter/test_filter/test_rule/edit', $edit, t('Save'));
$this
->assertUrl('admin/config/content/customfilter/test_filter');
$this
->drupalGet('admin/config/content/customfilter/test_filter');
// Test if there is a rule with new name.
$this
->assertRaw('New rule label', 'Updated rule with sucess.');
// Test if do not exist a rule with previous name, so the rule is edited
// and not inserted as a new one.
$this
->assertNoRaw('Rule Name', 'Previous rule do not exist.');
}