You are here

protected function InlineBlockTestBase::getLatestBlockEntityId in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php \Drupal\Tests\layout_builder\FunctionalJavascript\InlineBlockTestBase::getLatestBlockEntityId()

Gets the latest block entity id.

2 calls to InlineBlockTestBase::getLatestBlockEntityId()
InlineBlockTest::testAccess in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests access to the block edit form of inline blocks.
InlineBlockTest::testDeletion in core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
Tests that entity blocks deleted correctly.

File

core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTestBase.php, line 99

Class

InlineBlockTestBase
Base class for testing inline blocks.

Namespace

Drupal\Tests\layout_builder\FunctionalJavascript

Code

protected function getLatestBlockEntityId() {
  $block_ids = \Drupal::entityQuery('block_content')
    ->accessCheck(FALSE)
    ->sort('id', 'DESC')
    ->range(0, 1)
    ->execute();
  $block_id = array_pop($block_ids);
  $this
    ->assertNotEmpty($this->blockStorage
    ->load($block_id));
  return $block_id;
}