public function FilterAccessTest::testCreateAccess in Workbench Access 8
Test create access integration.
File
- tests/
src/ Kernel/ FilterAccessTest.php, line 106
Class
- FilterAccessTest
- Tests workbench_access integration with entity_test.
Namespace
Drupal\Tests\workbench_access\KernelCode
public function testCreateAccess() {
// The first user in a kernel test gets UID 1, so we need to make sure we're
// not testing with that user.
$this
->createUser();
// Create two users with equal permissions but assign one of them to the
// section.
$permissions = [
'administer filters',
];
$allowed_editor = $this
->createUser($permissions);
$this->container
->get('workbench_access.user_section_storage')
->addUser($this->scheme, $allowed_editor, [
'filter_html_escape',
]);
$allowed_editor
->save();
$editor_with_no_access = $this
->createUser($permissions);
$permissions[] = 'bypass workbench access';
$editor_with_bypass_access = $this
->createUser($permissions);
$this
->assertTrue($this->accessHandler
->createAccess('access_controlled', $allowed_editor));
$this
->assertFalse($this->accessHandler
->createAccess('access_controlled', $editor_with_no_access));
$this
->assertTrue($this->accessHandler
->createAccess('access_controlled', $editor_with_bypass_access));
}