function FilterDefaultConfigTest::testUpdateRoles
Same name in other branches
- 9 core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testUpdateRoles()
- 8.9.x core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testUpdateRoles()
- 10 core/modules/filter/tests/src/Kernel/FilterDefaultConfigTest.php \Drupal\Tests\filter\Kernel\FilterDefaultConfigTest::testUpdateRoles()
Tests that changes to FilterFormat::$roles do not have an effect.
File
-
core/
modules/ filter/ tests/ src/ Kernel/ FilterDefaultConfigTest.php, line 73
Class
- FilterDefaultConfigTest
- Tests text format default configuration.
Namespace
Drupal\Tests\filter\KernelCode
public function testUpdateRoles() : void {
// Verify role permissions declared in default config.
$format = FilterFormat::load('filter_test');
$this->assertEquals([
RoleInterface::ANONYMOUS_ID,
RoleInterface::AUTHENTICATED_ID,
], array_keys(filter_get_roles_by_format($format)));
// Attempt to change roles.
$format->set('roles', [
RoleInterface::AUTHENTICATED_ID,
]);
$format->save();
// Verify that roles have not been updated.
$format = FilterFormat::load('filter_test');
$this->assertEquals([
RoleInterface::ANONYMOUS_ID,
RoleInterface::AUTHENTICATED_ID,
], array_keys(filter_get_roles_by_format($format)));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.