function AssertContentTrait::cssSelect

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()
  2. 10 core/tests/Drupal/KernelTests/AssertContentTrait.php \Drupal\KernelTests\AssertContentTrait::cssSelect()
  3. 11.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.

13 calls to AssertContentTrait::cssSelect()
CommentAdminViewTest::doTestFilters in core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
Tests comment admin view display.
CommentTestBase::commentExists in core/modules/comment/src/Tests/CommentTestBase.php
Checks current page for specified comment.
LayoutBuilderCompatibilityTestBase::assertFieldAttributes in core/modules/layout_builder/tests/src/Kernel/LayoutBuilderCompatibilityTestBase.php
Asserts that the rendered entity has the correct fields.
LayoutBuilderFieldLayoutCompatibilityTest::testCompatibility in core/modules/layout_builder/tests/src/Kernel/LayoutBuilderFieldLayoutCompatibilityTest.php
Tests the compatibility of Layout Builder and Field Layout.
LayoutBuilderInstallTest::testCompatibility in core/modules/layout_builder/tests/src/Kernel/LayoutBuilderInstallTest.php
Tests the compatibility of Layout Builder with existing entity displays.

... See full list

File

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

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.