You are here

public function CustomFilterTest::testModule in Custom filter 8

Run all the tests.

File

src/Tests/CustomFilterTest.php, line 185

Class

CustomFilterTest
Test the Custom Filter administration and use.

Namespace

Drupal\customfilter\Tests

Code

public function testModule() {

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

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

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

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

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

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

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

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

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

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