function AssertContentTrait::cssSelect

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()
  2. 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()
  3. 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()
  4. 8.9.x core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()

Searches elements using a CSS selector in the raw content.

The search is relative to the root element (HTML tag normally) of the page.

Parameters

string $selector: CSS selector to use in the search.

Return value

\SimpleXMLElement[] The return value of the XPath search performed after converting the CSS selector to an XPath selector.

10 calls to AssertContentTrait::cssSelect()
LayoutBuilderCompatibilityTestBase::assertFieldAttributes in core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php
Asserts that the rendered entity has the correct fields.
LayoutBuilderInstallTest::testCompatibility in core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php
Tests the compatibility of Layout Builder with existing entity displays.
MediaEmbedFilterDisabledIntegrationsTest::testDisabledIntegrations in core/modules/media/tests/src/Kernel/MediaEmbedFilterDisabledIntegrationsTest.php
Tests disabled integrations.
MediaEmbedFilterTest::testAccessUnpublished in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
Tests that entity access is respected by embedding an unpublished entity.
MediaEmbedFilterTest::testBasics in core/modules/media/tests/src/Kernel/MediaEmbedFilterTest.php
Ensures media entities are rendered correctly.

... See full list

File

core/tests/Drupal/KernelTests/AssertContentTrait.php, line 235

Class

AssertContentTrait
Provides test methods to assert content.

Namespace

Drupal\KernelTests

Code

protected function cssSelect($selector) {
  return $this->xpath((new CssSelectorConverter())->toXPath($selector));
}

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