class BlockContentRemoveListingEmptyUpdateTest

Tests the removal of the empty listing plugin.

Attributes

#[Group('Update')]

Hierarchy

Expanded class hierarchy of BlockContentRemoveListingEmptyUpdateTest

See also

block_content_post_update_remove_block_content_listing_empty()

File

core/modules/block_content/tests/src/Functional/Update/BlockContentRemoveListingEmptyUpdateTest.php, line 16

Namespace

Drupal\Tests\block_content\Functional\Update
View source
class BlockContentRemoveListingEmptyUpdateTest extends UpdatePathTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() : void {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-10.3.0.filled.standard.php.gz',
    ];
  }
  
  /**
   * Tests the upgrade path to remove the empty listing plugin.
   */
  public function testBlockContentPostUpdateRemoveBlockContentListingEmpty() : void {
    $view = View::load('block_content');
    $data = $view->toArray();
    // Plugin exists in the view before updates.
    $this->assertNotEmpty($data['display']['default']['display_options']['empty']['block_content_listing_empty']);
    $this->runUpdates();
    $view = View::load('block_content');
    $data = $view->toArray();
    // Plugin is removed from the view after updates.
    $this->assertArrayNotHasKey('block_content_listing_empty', $data['display']['default']['display_options']['empty']);
    // Other empty plugins still remain.
    $this->assertNotEmpty($data['display']['default']['display_options']['empty']);
  }

}

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