You are here

public function AvatarKitManagerTest::testGetAvatarGeneratorsDisabledGenerators in Avatar Kit 8

Test access to avatar generators unavailable if status is disabled.

@covers ::getAvatarGeneratorsForUser

File

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

Class

AvatarKitManagerTest
Tests Avatar Manager.

Namespace

Drupal\Tests\avatars\Kernel

Code

public function testGetAvatarGeneratorsDisabledGenerators() {
  $generator_1 = AvatarGenerator::create([
    'label' => $this
      ->randomMachineName(),
    'id' => $this
      ->randomMachineName(),
    'plugin' => 'avatars_test_static',
  ]);
  $generator_1
    ->setStatus(FALSE)
    ->save();
  $user = $this
    ->createUser([
    'avatars avatar_generator user ' . $generator_1
      ->id(),
  ]);
  $generators = $this->avatarManager
    ->getAvatarGeneratorsForUser($user);
  $this
    ->assertEquals(0, count($generators));
}