public function ActionTestBase::testNoAccess in Organic groups 8
Checks that the user cannot perform the action on the membership.
@covers ::access
File
- tests/
src/ Kernel/ Action/ ActionTestBase.php, line 236
Class
- ActionTestBase
- Base class for testing action plugins.
Namespace
Drupal\Tests\og\Kernel\ActionCode
public function testNoAccess() {
// Dramatically improve testing speed by looping over all test cases in a
// single test, so that the expensive setup is not executed over and over.
$test_cases = $this
->noAccessProvider();
foreach ($test_cases as $test_case) {
list($user, $membership) = $test_case;
// When testing the group owner, configure whether or not they have full
// access.
if ($user === 'group_owner') {
$this
->config('og.settings')
->set('group_manager_full_access', $test_case[2])
->save();
}
$plugin = $this
->getPlugin();
$access_as_object = $plugin
->access($this->memberships[$membership], $this->users[$user], TRUE);
$this
->assertFalse($access_as_object instanceof AccessResultAllowed);
$access_as_boolean = $plugin
->access($this->memberships[$membership], $this->users[$user], FALSE);
$this
->assertFalse($access_as_boolean);
}
}