You are here

public function DefaultUserImageTest::testDefaultUserImage in Lightning Core 8.5

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/DefaultUserImageTest.php \Drupal\Tests\lightning_core\Kernel\DefaultUserImageTest::testDefaultUserImage()
  2. 8.4 tests/src/Kernel/DefaultUserImageTest.php \Drupal\Tests\lightning_core\Kernel\DefaultUserImageTest::testDefaultUserImage()

Tests that the default avatar is set.

File

tests/src/Kernel/DefaultUserImageTest.php, line 30

Class

DefaultUserImageTest
@group lightning_core

Namespace

Drupal\Tests\lightning_core\Kernel

Code

public function testDefaultUserImage() {
  \Drupal::service('module_installer')
    ->install([
    'lightning_core',
    'image',
  ]);
  $this
    ->assertFileExists('public://default-avatar.png');
  $config = FieldConfig::load('user.user.user_picture');
  $setting = $config
    ->getSetting('default_image');
  $this
    ->assertNotEmpty($setting['uuid']);
  $this
    ->assertSame('A generic silhouette of a person.', $setting['alt']);
  $this
    ->assertSame('', $setting['title']);
  $this
    ->assertSame(140, $setting['width']);
  $this
    ->assertSame(140, $setting['height']);
}