ImageImportTest.php in Drupal 9
File
core/modules/image/tests/src/Kernel/ImageImportTest.php
View source
<?php
namespace Drupal\Tests\image\Kernel;
use Drupal\image\Entity\ImageStyle;
use Drupal\KernelTests\KernelTestBase;
class ImageImportTest extends KernelTestBase {
protected static $modules = [
'system',
'image',
'image_module_test',
];
public function testImport() {
$style = ImageStyle::create([
'name' => 'test',
]);
$style
->addImageEffect([
'id' => 'image_module_test_null',
]);
$style
->addImageEffect([
'id' => 'image_module_test_null',
]);
$style
->save();
$this
->assertCount(2, $style
->getEffects());
$uuid = \Drupal::service('uuid')
->generate();
$style
->set('effects', [
$uuid => [
'id' => 'image_module_test_null',
],
]);
$style
->save();
$style = ImageStyle::load('test');
$this
->assertCount(1, $style
->getEffects());
}
}