You are here

public function CustomFilterTest::testModule in Custom filter 2.0.x

Run all the tests.

File

tests/src/Functional/CustomFilterTest.php, line 254

Class

CustomFilterTest
Test the Custom Filter administration and use.

Namespace

Drupal\Tests\customfilter\Functional

Code

public function testModule() {

  // Test create filter.
  $this
    ->createFilter();

  // Test create rules.
  $this
    ->createRule();
  $this
    ->createTimeRule();

  // Create a subrule.
  $this
    ->createSubRule();

  // Test create a new text format with your filter enabled.
  $this
    ->createTextFormat();

  // Create a node.
  $node = [
    'title' => 'Test for Custom Filter',
    'body' => [
      [
        'value' => 'Drupal [test]Goodbye Drupal 7[/test] at [time]',
        'format' => 'customfilter',
      ],
    ],
    'type' => 'test',
  ];
  $this
    ->drupalCreateNode($node);

  // Test the node content with the rule.
  $this
    ->rulesFilteringTest();

  // Edit the rule.
  $this
    ->editRule();

  // Edit the sub rule.
  $this
    ->editSubRule();

  // Delete the sub rule.
  $this
    ->deleteSubRule();

  // Delete the filter.
  $this
    ->deleteFilter();
}