public function AvatarKitPermissionsTest::testPermissions in Avatar Kit 8
Test default behaviour of testGetAvatarGeneratorsForUser().
Get all avatar generators for a user excluding user_preference plugins.
@covers ::avatarGenerators
File
- tests/
src/ Kernel/ AvatarKitPermissionsTest.php, line 46
Class
- AvatarKitPermissionsTest
- Tests generated permissions.
Namespace
Drupal\Tests\avatars\KernelCode
public function testPermissions() {
$generator_1 = AvatarGenerator::create([
'label' => $this
->randomMachineName(),
'id' => $this
->randomMachineName(),
'plugin' => 'user_preference',
]);
$generator_1
->setStatus(TRUE)
->save();
$generator_2 = AvatarGenerator::create([
'label' => $this
->randomMachineName(),
'id' => $this
->randomMachineName(),
'plugin' => 'avatars_test_static',
]);
$generator_2
->setStatus(TRUE)
->save();
$permissions = $this->permissionHandler
->getPermissions();
$this
->assertFalse(isset($permissions['avatars avatar_generator user ' . $generator_1
->id()]));
$this
->assertTrue(isset($permissions['avatars avatar_generator user ' . $generator_2
->id()]));
}