public function CustomFormattersGeneralTest::testCustomFormatterTypeTwig in Custom Formatters 8.3
Test the Twig engine.
@TODO - Add manual creation test.
File
- src/
Tests/ CustomFormattersGeneralTest.php, line 120
Class
- CustomFormattersGeneralTest
- Test general functionality.
Namespace
Drupal\custom_formatters\TestsCode
public function testCustomFormatterTypeTwig() {
// Create a Custom formatter.
$text = $this
->randomMachineName();
$this->formatter = $this
->createCustomFormatter([
'type' => 'twig',
'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.'));
}