You are here

protected function AvatarKitWebTestBase::setAvatarGeneratorPreferences in Avatar Kit 8

Set avatar generator preferences.

Ordered list of avatar generators, keyed by avatar generator plugin ID with boolean value whether generator is to be enabled.

1 call to AvatarKitWebTestBase::setAvatarGeneratorPreferences()
AvatarKitGeneratorTest::testGenerator in tests/src/Functional/AvatarKitGeneratorTest.php
Test avatar generators.

File

tests/src/Functional/AvatarKitWebTestBase.php, line 71

Class

AvatarKitWebTestBase
Avatar Kit web test base.

Namespace

Drupal\Tests\avatars\Functional

Code

protected function setAvatarGeneratorPreferences(array $avatar_generators) {
  $weight = -10;
  foreach ($avatar_generators as $id => $status) {

    /** @var \Drupal\avatars\AvatarGeneratorInterface $avatar_generator */
    $avatar_generator = $this->avatarGeneratorStorage
      ->load($id);
    $avatar_generator
      ->setWeight($weight)
      ->setStatus($status)
      ->save();
    $weight++;
  }
}