public function LinkitFilterEntityTest::testTitleOverwritten in Linkit 8.5
Tests that the linkit filter do not overwrite provided title attributes.
File
- tests/
src/ Kernel/ LinkitFilterEntityTest.php, line 141
Class
- LinkitFilterEntityTest
- Tests the Linkit filter.
Namespace
Drupal\Tests\linkit\KernelCode
public function testTitleOverwritten() {
// Create an entity.
$entity = EntityTest::create([
'name' => $this
->randomMachineName(),
]);
$entity
->save();
// Automatically set the title.
$this->filter
->setConfiguration([
'settings' => [
'title' => 1,
],
]);
// Make sure the title is not overwritten.
$input = '<a data-entity-type="' . $entity
->getEntityTypeId() . '" data-entity-uuid="' . $entity
->uuid() . '" title="Do not override">Link text</a>';
$this
->assertTrue(strpos($this
->process($input)
->getProcessedText(), 'Do not override') !== FALSE, 'The filer is not overwrite the provided title attribute value.');
}