'twig_theme_test_filter', '#quote' => [ 'content' => ['#markup' => 'You can only find truth with logic if you have already found truth without it.'], 'author' => ['#markup' => 'Gilbert Keith Chesterton'], 'date' => ['#markup' => '1874-1936'], ], '#attributes' => [ 'id' => 'quotes', 'checked' => TRUE, 'class' => ['red', 'green', 'blue'], ], ]; $rendered = \Drupal::service('renderer')->renderRoot($filter_test); $this->setRawContent($rendered); $elements = [ [ 'expected' => '
No author: You can only find truth with logic if you have already found truth without it.1874-1936.
', 'message' => '"No author" was successfully rendered.', ], [ 'expected' => '
Complete quote after without: You can only find truth with logic if you have already found truth without it.Gilbert Keith Chesterton1874-1936.
', 'message' => '"Complete quote after without" was successfully rendered.', ], [ 'expected' => '
Only author: Gilbert Keith Chesterton.
', 'message' => '"Only author:" was successfully rendered.', ], [ 'expected' => '
No author or date: You can only find truth with logic if you have already found truth without it..
', 'message' => '"No author or date" was successfully rendered.', ], [ 'expected' => '
Only date: 1874-1936.
', 'message' => '"Only date" was successfully rendered.', ], [ 'expected' => '
Complete quote again for good measure: You can only find truth with logic if you have already found truth without it.Gilbert Keith Chesterton1874-1936.
', 'message' => '"Complete quote again for good measure" was successfully rendered.', ], [ 'expected' => '
Marked-up:

You can only find truth with logic if you have already found truth without it.

', 'message' => '"Marked-up quote" was successfully rendered.', ], [ 'expected' => '
All attributes:
', 'message' => 'All attributes printed.', ], [ 'expected' => '
Class attributes in front, remainder at the back:
', 'message' => 'Class attributes printed in the front, the rest in the back.', ], [ 'expected' => '
Class attributes in back, remainder at the front:
', 'message' => 'Class attributes printed in the back, the rest in the front.', ], [ 'expected' => '
Class attributes only:
', 'message' => 'Class attributes only printed.', ], [ 'expected' => '
Without boolean attribute.
', 'message' => 'Boolean attribute printed in the front.', ], [ 'expected' => '
Without string attribute.
', 'message' => 'Without string attribute in the front.', ], [ 'expected' => '
Without id and class attributes.
', 'message' => 'Attributes printed without id and class attributes.', ], [ 'expected' => '
All attributes again.
', 'message' => 'All attributes printed again.', ], [ 'expected' => '
ID and class. Having the same ID twice is not valid markup but we want to make sure the filter doesn\'t use \Drupal\Component\Utility\Html::getUniqueId().
', 'message' => 'Class and ID filtered.', ], [ 'expected' => '
Rendered author string length: 24.
', 'message' => 'Render filter string\'s length.', ], ]; foreach ($elements as $element) { $this->assertRaw($element['expected'], $element['message']); } } }