function InlineBlockUsageTest::testRemoveByLayoutEntity

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

Covers ::removeByLayoutEntity.

File

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

Class

InlineBlockUsageTest
Class for testing the InlineBlockUsage service.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

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

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