function ResponsiveImageOrderMultipliersNumericallyUpdateTest::testEntitySave
Same name in other branches
- 11.x core/modules/responsive_image/tests/src/Functional/ResponsiveImageOrderMultipliersNumericallyUpdateTest.php \Drupal\Tests\responsive_image\Functional\ResponsiveImageOrderMultipliersNumericallyUpdateTest::testEntitySave()
Test ResponsiveImageStyle::preSave correctly orders by multiplier weight.
@covers ::orderMultipliersNumerically
File
-
core/
modules/ responsive_image/ tests/ src/ Functional/ ResponsiveImageOrderMultipliersNumericallyUpdateTest.php, line 57
Class
- ResponsiveImageOrderMultipliersNumericallyUpdateTest
- Tests order multipliers numerically upgrade path.
Namespace
Drupal\Tests\responsive_image\FunctionalCode
public function testEntitySave() : void {
$this->expectDeprecation('The responsive image style multiplier re-ordering update for "responsive_image_style" is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Profile, module and theme provided Responsive Image configuration should be updated. See https://www.drupal.org/node/3274803');
$image_style = ResponsiveImageStyle::load('responsive_image_style');
$mappings = $image_style->getImageStyleMappings();
$this->assertEquals('1.5x', $mappings[0]['multiplier']);
$this->assertEquals('2x', $mappings[1]['multiplier']);
$this->assertEquals('1x', $mappings[2]['multiplier']);
$image_style->save();
$mappings = ResponsiveImageStyle::load('responsive_image_style')->getImageStyleMappings();
$this->assertEquals('1x', $mappings[0]['multiplier']);
$this->assertEquals('1.5x', $mappings[1]['multiplier']);
$this->assertEquals('2x', $mappings[2]['multiplier']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.