function CKEditor5TestBase::assertHtmlEsqueFieldValueEquals

Same name in other branches
  1. 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::assertHtmlEsqueFieldValueEquals()
  2. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5TestBase::assertHtmlEsqueFieldValueEquals()

Decorates ::fieldValueEquals() to force DrupalCI to provide useful errors.

Parameters

string $field: Field id|name|label|value.

string $value: Field value.

\Behat\Mink\Element\TraversableElement $container: Document to check against.

Throws

\Behat\Mink\Exception\ExpectationException

See also

\Behat\Mink\WebAssert::fieldValueEquals()

4 calls to CKEditor5TestBase::assertHtmlEsqueFieldValueEquals()
CKEditor5AllowedTagsTest::testAllowedTags in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
Test filter_html allowed tags.
CKEditor5AllowedTagsTest::testMediaElementAllowedTags in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
Test that <drupal-media> is added to allowed tags when media embed enabled.
CKEditor5AllowedTagsTest::testSwitchToVersion5 in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5AllowedTagsTest.php
Confirm that switching to CKEditor 5 from another editor updates tags.
CKEditor5Test::testHeadingsPlugin in core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5Test.php
Test headings configuration.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5TestBase.php, line 128

Class

CKEditor5TestBase
Base class for testing CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function assertHtmlEsqueFieldValueEquals($field, $value, TraversableElement $container = NULL) {
    $assert_session = $this->assertSession();
    $node = $assert_session->fieldExists($field, $container);
    $actual = $node->getValue();
    $regex = '/^' . preg_quote($value, '/') . '$/ui';
    $message = sprintf('The field "%s" value is "%s", but "%s" expected.', $field, htmlspecialchars($actual), htmlspecialchars($value));
    $assert_session->assert((bool) preg_match($regex, $actual), $message);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.