function PermissionsPerBundleTest::testActionIsOnlyAvailableToUserRoles

Tests that the permissions-per-bundle action can only be applied to roles.

File

core/tests/Drupal/KernelTests/Core/Recipe/PermissionsPerBundleTest.php, line 115

Class

PermissionsPerBundleTest
@covers <a href="/api/drupal/core%21lib%21Drupal%21Core%21Config%21Action%21Plugin%21ConfigAction%21PermissionsPerBundle.php/class/PermissionsPerBundle/11.x" title="@internal This API is experimental." class="local">\Drupal\Core\Config\Action\Plugin\ConfigAction\PermissionsPerBundle</a> @covers <a href="/api/drupal/core%21lib%21Drupal%21Core%21Config%21Action%21Plugin%21ConfigAction%21Deriver%21PermissionsPerBundleDeriver.php/class/PermissionsPerBundleDeriver/11.x" title="@internal This API is experimental." class="local">\Drupal\Core\Config\Action\Plugin\ConfigAction\Deriver\PermissionsPerBundleDeriver</a>

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testActionIsOnlyAvailableToUserRoles() : void {
    $recipe_data = <<<YAML
name: 'Only for roles...'
config:
  actions:
    field.storage.node.body:
      grantPermissionsForEachNodeType:
        - create %bundle content
        - edit own %bundle content
YAML;
    $this->expectException(PluginNotFoundException::class);
    $this->expectExceptionMessage('The "grantPermissionsForEachNodeType" plugin does not exist.');
    $this->applyRecipeFromString($recipe_data);
}

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