public function ImageImportTest::testImport in Drupal 9
Same name and namespace in other branches
- 8 core/modules/image/tests/src/Kernel/ImageImportTest.php \Drupal\Tests\image\Kernel\ImageImportTest::testImport()
Tests importing image styles.
File
- core/
modules/ image/ tests/ src/ Kernel/ ImageImportTest.php, line 23
Class
- ImageImportTest
- Tests config import for Image styles.
Namespace
Drupal\Tests\image\KernelCode
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());
}