You are here

protected function QuickEditJavascriptTestBase::assertEntityInstanceFieldMarkup in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase::assertEntityInstanceFieldMarkup()
  2. 10 core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php \Drupal\Tests\quickedit\FunctionalJavascript\QuickEditJavascriptTestBase::assertEntityInstanceFieldMarkup()

Asserts all in-place editable fields with markup expectations.

@todo https://www.drupal.org/project/drupal/issues/3178758 Remove deprecation layer and add array typehint.

Parameters

array $expected_field_attributes: Must describe the expected markup attributes for all given in-place editable fields.

5 calls to QuickEditJavascriptTestBase::assertEntityInstanceFieldMarkup()
LayoutBuilderQuickEditTest::assertEntityInstanceFieldMarkup in core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all in-place editable fields with markup expectations.
QuickEditImageTest::testImageInPlaceEditor in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditImageTest.php
Tests that quick editor works correctly with images.
QuickEditIntegrationTest::testArticleNode in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
Tests if an article node can be in-place edited with Quick Edit.
QuickEditIntegrationTest::testCustomBlock in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditIntegrationTest.php
Tests if a custom can be in-place edited with Quick Edit.
QuickEditJavascriptTestBase::assertEntityInstanceFieldStates in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php
Asserts all FieldModels for the given entity instance.
1 method overrides QuickEditJavascriptTestBase::assertEntityInstanceFieldMarkup()
LayoutBuilderQuickEditTest::assertEntityInstanceFieldMarkup in core/modules/quickedit/tests/src/FunctionalJavascript/LayoutBuilderQuickEditTest.php
Asserts all in-place editable fields with markup expectations.

File

core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditJavascriptTestBase.php, line 257

Class

QuickEditJavascriptTestBase
Base class for testing the QuickEdit.

Namespace

Drupal\Tests\quickedit\FunctionalJavascript

Code

protected function assertEntityInstanceFieldMarkup($expected_field_attributes) {
  if (func_num_args() === 4) {
    $expected_field_attributes = func_get_arg(3);
    @trigger_error('Calling ' . __METHOD__ . '() with 4 arguments is deprecated in drupal:9.1.0 and will throw an error in drupal:10.0.0. See https://www.drupal.org/project/drupal/issues/3037436', E_USER_DEPRECATED);
  }
  if (!is_array($expected_field_attributes)) {
    throw new \InvalidArgumentException('The $expected_field_attributes argument must be an array.');
  }
  foreach ($expected_field_attributes as $quickedit_field_id => $expectation) {
    $element = $this
      ->assertSession()
      ->waitForElementVisible('css', '[data-quickedit-field-id="' . $quickedit_field_id . '"]' . $expectation);
    $this
      ->assertNotEmpty($element, 'Field ' . $quickedit_field_id . ' did not match its expectation selector (' . $expectation . ')');
  }
}