CckSelectOtherHtmlEntitiesTest.php in CCK Select Other 8
File
tests/src/Functional/CckSelectOtherHtmlEntitiesTest.php
View source
<?php
namespace Drupal\Tests\cck_select_other\Functional;
class CckSelectOtherHtmlEntitiesTest extends CckSelectOtherTestBase {
public function testHtmlEntities() {
$options = $this
->createOptions();
$field_info = [
'settings' => [
'allowed_values' => $options,
],
'cardinality' => 1,
];
$config_info = [
'required' => 0,
];
$field = $this
->createSelectOtherListField('list_string', $field_info, $config_info);
$field_name = $field
->getName();
$this
->drupalLogin($this->webUser);
$edit = [
'title[0][value]' => $this
->randomString(25),
$field_name . '[0][select_other_list]' => 'other',
$field_name . '[0][select_other_text_input]' => '&',
];
$this
->drupalPostForm('/node/add/' . $this->contentType
->id(), $edit, 'Save');
$raw = html_entity_decode($this
->getSession()
->getPage()
->getHtml());
$this
->assertNotContains('<div class="field__item">&</div>', $raw);
}
}