function PermissionsPerBundleTest::testInvalidValue
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Recipe/PermissionsPerBundleTest.php \Drupal\KernelTests\Core\Recipe\PermissionsPerBundleTest::testInvalidValue()
Tests that there is an exception if the permission templates are invalid.
@testWith [["a %Bundle permission"]] [""] [[]]
Parameters
mixed $value: The permission template which should raise an error.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ PermissionsPerBundleTest.php, line 205
Class
- PermissionsPerBundleTest
- @covers \Drupal\Core\Config\Action\Plugin\ConfigAction\PermissionsPerBundle @covers \Drupal\Core\Config\Action\Plugin\ConfigAction\Deriver\PermissionsPerBundleDeriver
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testInvalidValue(mixed $value) : void {
$value = Json::encode($value);
$recipe_data = <<<YAML
name: 'Bad permission value'
config:
actions:
user.role.super_editor:
grantPermissionsForEachMediaType: {<span class="php-variable">$value</span>}
YAML;
$this->expectException(ConfigActionException::class);
$this->expectExceptionMessage(" must be an array of strings that contain '%bundle'.");
$this->applyRecipeFromString($recipe_data);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.