function SystemMenuBlockTest::testSystemMenuBlockConfigDependencies

Same name in other branches
  1. 9 core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php \Drupal\Tests\system\Kernel\Block\SystemMenuBlockTest::testSystemMenuBlockConfigDependencies()
  2. 8.9.x core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php \Drupal\Tests\system\Kernel\Block\SystemMenuBlockTest::testSystemMenuBlockConfigDependencies()
  3. 11.x core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php \Drupal\Tests\system\Kernel\Block\SystemMenuBlockTest::testSystemMenuBlockConfigDependencies()

Tests calculation of a system menu block's configuration dependencies.

File

core/modules/system/tests/src/Kernel/Block/SystemMenuBlockTest.php, line 154

Class

SystemMenuBlockTest
Tests \Drupal\system\Plugin\Block\SystemMenuBlock.

Namespace

Drupal\Tests\system\Kernel\Block

Code

public function testSystemMenuBlockConfigDependencies() : void {
    $block = Block::create([
        'plugin' => 'system_menu_block:' . $this->menu
            ->id(),
        'region' => 'footer',
        'id' => 'machine_name',
        'theme' => 'stark',
    ]);
    $dependencies = $block->calculateDependencies()
        ->getDependencies();
    $expected = [
        'config' => [
            'system.menu.' . $this->menu
                ->id(),
        ],
        'module' => [
            'system',
        ],
        'theme' => [
            'stark',
        ],
    ];
    $this->assertSame($expected, $dependencies);
}

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