function InlineBlockUsageTest::testAddUsage

Same name in other branches
  1. 11.x core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php \Drupal\Tests\layout_builder\Kernel\InlineBlockUsageTest::testAddUsage()

Covers ::addUsage.

File

core/modules/layout_builder/tests/src/Kernel/InlineBlockUsageTest.php, line 60

Class

InlineBlockUsageTest
Class for testing the InlineBlockUsage service.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testAddUsage() : void {
    $this->inlineBlockUsage
        ->addUsage('1', $this->entity);
    $results = $this->database
        ->select('inline_block_usage')
        ->fields('inline_block_usage')
        ->condition('block_content_id', 1)
        ->condition('layout_entity_id', $this->entity
        ->id())
        ->condition('layout_entity_type', $this->entity
        ->getEntityTypeId())
        ->execute()
        ->fetchAll();
    $this->assertCount(1, $results);
}

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