You are here

public function AvatarKitManagerTest::testGetAvatarGeneratorsForUserWithoutPermissions in Avatar Kit 8

Get all avatar generators for a user including user_preference plugins.

@covers ::getAvatarGeneratorsForUser

File

tests/src/Kernel/AvatarKitManagerTest.php, line 126

Class

AvatarKitManagerTest
Tests Avatar Manager.

Namespace

Drupal\Tests\avatars\Kernel

Code

public function testGetAvatarGeneratorsForUserWithoutPermissions() {
  $generator_1 = AvatarGenerator::create([
    'label' => $this
      ->randomMachineName(),
    'id' => $this
      ->randomMachineName(),
    'plugin' => 'avatars_test_static',
  ]);
  $generator_1
    ->setStatus(TRUE)
    ->save();
  $user = $this
    ->createUser();
  $generators = $this->avatarManager
    ->getAvatarGeneratorsForUser($user);
  $this
    ->assertEquals(0, count($generators), 'User does not have access to any avatar generators.');
}