function BlockValidationTest::testMenuBlockLevelAndDepth

Tests validating menu block `level` and `depth` settings.

@dataProvider providerMenuBlockLevelAndDepth

File

core/modules/block/tests/src/Kernel/BlockValidationTest.php, line 249

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\Kernel

Code

public function testMenuBlockLevelAndDepth(int $level, ?int $depth, array $expected_errors) : void {
  $this->installConfig('system');
  $this->entity = Block::create([
    'id' => 'account_menu',
    'theme' => 'stark',
    'plugin' => 'system_menu_block:account',
    'settings' => [
      'id' => 'system_menu_block:account',
      'label' => 'Account Menu',
      'label_display' => FALSE,
      'provider' => 'system',
      'level' => $level,
      'depth' => $depth,
      'expand_all_items' => FALSE,
    ],
    'region' => 'content',
  ]);
  $this->assertValidationErrors($expected_errors);
}

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