function ViewsBlockTest::testSaveBlockWithDeprecatedItemsPerPageSetting

Tests that saving a Views block with items_per_page = `none` is deprecated.

@covers \Drupal\views\Hook\ViewsHooks::blockPresave

@group legacy

File

core/modules/views/tests/src/Kernel/Plugin/ViewsBlockTest.php, line 156

Class

ViewsBlockTest
Tests native behaviors of the block views plugin.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function testSaveBlockWithDeprecatedItemsPerPageSetting() : void {
  $this->container
    ->get(ThemeInstallerInterface::class)
    ->install([
    'stark',
  ]);
  $this->expectDeprecation('Saving a views block with "none" items per page is deprecated in drupal:11.2.0 and removed in drupal:12.0.0. To use the items per page defined by the view, use NULL. See https://www.drupal.org/node/3522240');
  $block = $this->placeBlock('views_block:test_view_block-block_1', [
    'items_per_page' => 'none',
  ]);
  $settings = $block->get('settings');
  $this->assertNull($settings['items_per_page']);
}

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