You are here

public function AvatarKitAdminSettingsTest::testGeneratorAdd in Avatar Kit 8

Test add avatar generator config.

File

tests/src/Functional/AvatarKitAdminSettingsTest.php, line 50

Class

AvatarKitAdminSettingsTest
Avatar Kit admin settings test.

Namespace

Drupal\Tests\avatars\Functional

Code

public function testGeneratorAdd() {
  $this
    ->drupalGet('admin/config/people/avatars/generators/add');
  $this
    ->assertResponse(200);
  $id = mb_strtolower($this
    ->randomMachineName());
  $label = $this
    ->randomString();
  $edit = [
    'label' => $label,
    'id' => $id,
    'plugin' => 'avatars_test_dynamic',
  ];
  $this
    ->drupalPostForm('admin/config/people/avatars/generators/add', $edit, t('Save'));
  $t_args = [
    '%label' => $label,
  ];
  $this
    ->assertRaw(t('Created avatar generator %label', $t_args));
  $this
    ->assertUrl('admin/config/people/avatars/generators/' . $id);
}