function AddNavigationBlockConfigActionTest::testActionOnlySupportsNavigationConfig

Checks invalid config exception.

File

core/modules/navigation/tests/src/Kernel/ConfigAction/AddNavigationBlockConfigActionTest.php, line 88

Class

AddNavigationBlockConfigActionTest
@covers \Drupal\navigation\Plugin\ConfigAction\AddNavigationBlock @group navigation @group Recipe

Namespace

Drupal\Tests\navigation\Kernel\ConfigAction

Code

public function testActionOnlySupportsNavigationConfig() : void {
    $this->expectException(ConfigActionException::class);
    $this->expectExceptionMessage('addNavigationBlock can only be executed for the navigation.block_layout config.');
    // Try to apply the Config Action against an unexpected config entity.
    
    /** @var \Drupal\Core\Config\Action\ConfigActionManager $manager */
    $manager = $this->container
        ->get('plugin.manager.config_action');
    $manager->applyAction('addNavigationBlock', 'navigation.settings', []);
}

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