function SystemMenuNavigationBlockTest::testSystemMenuBlockConfigDependencies

Same name in other branches
  1. 11.x core/modules/navigation/tests/src/Kernel/SystemMenuNavigationBlockTest.php \Drupal\Tests\navigation\Kernel\SystemMenuNavigationBlockTest::testSystemMenuBlockConfigDependencies()

Tests calculation of a system navigation menu block's config dependencies.

File

core/modules/navigation/tests/src/Kernel/SystemMenuNavigationBlockTest.php, line 161

Class

SystemMenuNavigationBlockTest
Tests \Drupal\navigation\Plugin\Block\SystemMenuNavigationBlock.

Namespace

Drupal\Tests\navigation\Kernel

Code

public function testSystemMenuBlockConfigDependencies() : void {
    $block = Block::create([
        'plugin' => 'navigation_menu:' . $this->menu
            ->id(),
        'region' => 'content',
        'id' => 'machine_name',
        'theme' => 'stark',
    ]);
    $dependencies = $block->calculateDependencies()
        ->getDependencies();
    $expected = [
        'config' => [
            'system.menu.' . $this->menu
                ->id(),
        ],
        'module' => [
            'navigation',
            '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.