diff --git a/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php new file mode 100644 index 0000000..d939144 --- /dev/null +++ b/core/modules/image/src/Tests/Update/ScaleAndCropUpscaleUpdateTest.php @@ -0,0 +1,45 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + __DIR__ . '/../../../tests/fixtures/update/test_scale_and_crop_upscale.php', + ]; + } + + /** + * Tests that 'upscale' parameter is updated properly. + */ + public function testImagePostUpdateScaleAndCropEffectUpscale() { + $image_style = ImageStyle::load('test_scale_and_crop_upscale'); + // Test that Scale and crop effect does not have 'upscale' parameter set. + $effects = $image_style->getEffects(); + $this->assertFalse(isset($effects[0]->getConfiguration()['data']['upscale'])); + + $this->runUpdates(); + + $image_style = ImageStyle::load('test_scale_and_crop_upscale'); + // Test that Scale and crop effect has 'upscale' parameter set. + $effects = $image_style->getEffects(); + $this->assertTrue(isset($effects[0]->getConfiguration()['data']['upscale'])); + $this->assertFalse($effects[0]->getConfiguration()['data']['upscale']); + } + +} diff --git a/core/modules/image/tests/fixtures/update/image.image_style.test_scale_and_crop_upscale.yml b/core/modules/image/tests/fixtures/update/image.image_style.test_scale_and_crop_upscale.yml new file mode 100644 index 0000000..118006a --- /dev/null +++ b/core/modules/image/tests/fixtures/update/image.image_style.test_scale_and_crop_upscale.yml @@ -0,0 +1,13 @@ +uuid: b17c6242-453b-4fe4-8323-396488e1f043 +langcode: en +status: true +name: test_scale_and_crop_upscale +label: test_scale_and_crop_upscale +effects: + 637b75a0-a80a-4bcc-8300-66994a27871d: + uuid: 637b75a0-a80a-4bcc-8300-66994a27871d + id: image_scale_and_crop + weight: 1 + data: + width: 100 + height: 100 diff --git a/core/modules/image/tests/fixtures/update/test_scale_and_crop_upscale.php b/core/modules/image/tests/fixtures/update/test_scale_and_crop_upscale.php new file mode 100644 index 0000000..1e3f60d --- /dev/null +++ b/core/modules/image/tests/fixtures/update/test_scale_and_crop_upscale.php @@ -0,0 +1,19 @@ +insert('config') + ->fields(array( + 'collection' => '', + 'name' => 'image.style.test_scale_and_crop_upscale', + 'data' => serialize(Yaml::decode(file_get_contents('core/modules/image/tests/fixtures/update/image.image_style.test_scale_and_crop_upscale.yml'))), + )) + ->execute();