class ImageImportTest in Drupal 10
Same name and namespace in other branches
- 8 core/modules/image/tests/src/Kernel/ImageImportTest.php \Drupal\Tests\image\Kernel\ImageImportTest
- 9 core/modules/image/tests/src/Kernel/ImageImportTest.php \Drupal\Tests\image\Kernel\ImageImportTest
Tests config import for Image styles.
@group image
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, ConfigTestTrait, ExtensionListTestTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\Tests\image\Kernel\ImageImportTest
Expanded class hierarchy of ImageImportTest
File
- core/
modules/ image/ tests/ src/ Kernel/ ImageImportTest.php, line 13
Namespace
Drupal\Tests\image\KernelView source
class ImageImportTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'system',
'image',
'image_module_test',
];
/**
* Tests importing image styles.
*/
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());
}
}