public function WrapperClassFormatterTest::testTextWithSummary in Element Class Formatter 8
Tests summary formatter.
@dataProvider providerSummaryFormatter
File
- tests/
src/ Functional/ WrapperClassFormatterTest.php, line 48
Class
- WrapperClassFormatterTest
- Functional tests for the mailto link with class formatter.
Namespace
Drupal\Tests\element_class_formatter\FunctionalCode
public function testTextWithSummary(bool $summary, string $expected, int $trim = NULL) {
$format = FilterFormat::create([
'format' => $this
->randomMachineName(),
]);
$format
->save();
$formatter_settings = [
'class' => self::TEST_CLASS,
'tag' => 'h2',
'summary' => $summary,
];
$field_config = $this
->createEntityField('wrapper_class', 'text_with_summary', $formatter_settings);
$entity = EntityTest::create([
$field_config
->getName() => [
[
'value' => 'I am a string',
'summary' => !$trim ? 'I am a summary' : '',
'format' => $format
->id(),
],
],
]);
$entity
->save();
$this
->drupalGet($entity
->toUrl());
$assert_session = $this
->assertSession();
$assert_session
->elementTextContains('css', 'h2.' . self::TEST_CLASS, $expected);
}