You are here

protected function CustomFilterTest::editSubRule in Custom filter 8

Edit a existing subrule.

1 call to CustomFilterTest::editSubRule()
CustomFilterTest::testModule in src/Tests/CustomFilterTest.php
Run all the tests.

File

src/Tests/CustomFilterTest.php, line 156

Class

CustomFilterTest
Test the Custom Filter administration and use.

Namespace

Drupal\customfilter\Tests

Code

protected function editSubRule() {
  $edit = array();
  $edit['name'] = 'Renamed Subrule';
  $edit['description'] = 'New subrule description';
  $edit['matches'] = 1;
  $edit['pattern'] = '/Drupal/i';
  $edit['code'] = FALSE;
  $edit['replacement'] = '<font color="blue">Drupal</font>';
  $this
    ->drupalPostForm('admin/config/content/customfilter/test_filter/test_subrule/edit', $edit, t('Save'));
  $this
    ->assertText("Renamed Subrule", 'Subrule edited with sucess');
  $this
    ->assertUrl('admin/config/content/customfilter/test_filter');

  // Test if there is a rule with new name.
  $this
    ->assertRaw('Renamed Subrule', '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('Subrule Name', 'Previous rule do not exist.');
}