function InlineBlockUsageTest::testDeleteUsage

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

Covers ::deleteUsage.

File

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

Class

InlineBlockUsageTest
Class for testing the InlineBlockUsage service.

Namespace

Drupal\Tests\layout_builder\Kernel

Code

public function testDeleteUsage() : void {
    $this->inlineBlockUsage
        ->addUsage('1', $this->entity);
    $this->inlineBlockUsage
        ->deleteUsage([
        '1',
    ]);
    $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->assertEmpty($results);
}

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