You are here

public function CustomFormattersGeneralTest::testCustomFormatterTypeHtmlToken in Custom Formatters 8.3

Test the HTML + Token engine.

@TODO - Add manual creation test.

File

src/Tests/CustomFormattersGeneralTest.php, line 141

Class

CustomFormattersGeneralTest
Test general functionality.

Namespace

Drupal\custom_formatters\Tests

Code

public function testCustomFormatterTypeHtmlToken() {

  // Create a Custom formatter.
  $text = $this
    ->randomMachineName();
  $this->formatter = $this
    ->createCustomFormatter([
    'type' => 'html_token',
    'data' => $text,
  ]);

  // Set the formatter active on the Body field.
  $this
    ->setCustomFormatter($this->formatter
    ->id(), 'body', 'article');

  // Ensure Formatter rendered correctly.
  $this
    ->drupalGet($this->node
    ->toUrl());
  $this
    ->assertText($text, t('Custom formatter output found.'));
}