public function DefaultUserImageTest::testAlreadyExists in Lightning Core 8.5
Same name and namespace in other branches
- 8.3 tests/src/Kernel/DefaultUserImageTest.php \Drupal\Tests\lightning_core\Kernel\DefaultUserImageTest::testAlreadyExists()
- 8.4 tests/src/Kernel/DefaultUserImageTest.php \Drupal\Tests\lightning_core\Kernel\DefaultUserImageTest::testAlreadyExists()
Tests that the default avatar is not set if the image already exists.
File
- tests/
src/ Kernel/ DefaultUserImageTest.php, line 49
Class
- DefaultUserImageTest
- @group lightning_core
Namespace
Drupal\Tests\lightning_core\KernelCode
public function testAlreadyExists() {
file_put_contents('public://default-avatar.png', '');
\Drupal::service('module_installer')
->install([
'lightning_core',
'image',
]);
$this
->assertEmpty(File::loadMultiple());
$config = FieldConfig::load('user.user.user_picture');
$setting = $config
->getSetting('default_image');
$this
->assertNull($setting['uuid']);
$this
->assertSame('', $setting['alt']);
$this
->assertSame('', $setting['title']);
$this
->assertNull($setting['width']);
$this
->assertNull($setting['height']);
}