protected function RateTypeAccessTest::setUp in Rate 8
Same name and namespace in other branches
- 8.2 tests/src/Kernel/RateTypeAccessTest.php \Drupal\Tests\rate\Kernel\RateTypeAccessTest::setUp()
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ RateTypeAccessTest.php, line 69
Class
- RateTypeAccessTest
- Tests access control for vote_types defined in the Rate module.
Namespace
Drupal\Tests\rate\KernelCode
protected function setUp() {
parent::setUp();
$this
->installSchema('system', 'sequences');
$this
->installEntitySchema('user');
$this
->installConfig('rate');
$this->accessHandler = $this->container
->get('entity_type.manager')
->getAccessControlHandler('vote_type');
// Clear permissions for authenticated users.
$this
->config('user.role.' . RoleInterface::AUTHENTICATED_ID)
->set('permissions', [])
->save();
// Create user 1 who has special permissions.
$this
->drupalCreateUser();
$this->loggedInUser = $this
->drupalCreateUser([
'view rate results page',
]);
$this->anonymousUser = $this
->drupalCreateUser([]);
}