function BlockContentIntegrationTest::assertIds

Same name in other branches
  1. 9 core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentIntegrationTest::assertIds()
  2. 8.9.x core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentIntegrationTest::assertIds()
  3. 10 core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php \Drupal\Tests\block_content\Functional\Views\BlockContentIntegrationTest::assertIds()

Ensures that a list of block_contents appear on the page.

@internal

Parameters

array $expected_ids: An array of block_content IDs.

1 call to BlockContentIntegrationTest::assertIds()
BlockContentIntegrationTest::testBlockContentViewTypeArgument in core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php
Tests basic block_content view with a block_content_type argument.

File

core/modules/block_content/tests/src/Functional/Views/BlockContentIntegrationTest.php, line 67

Class

BlockContentIntegrationTest
Tests the block_content integration into views.

Namespace

Drupal\Tests\block_content\Functional\Views

Code

protected function assertIds(array $expected_ids = []) : void {
    $result = $this->xpath('//span[@class="field-content"]');
    $ids = [];
    foreach ($result as $element) {
        $ids[] = $element->getText();
    }
    $this->assertEquals($expected_ids, $ids);
}

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