You are here

public function MigrateResponsiveImageStylesTest::testResponsiveImageStyles in Drupal 9

Tests the Drupal 7 to Drupal 8 responsive image styles migration.

File

core/modules/responsive_image/tests/src/Kernel/Migrate/d7/MigrateResponsiveImageStylesTest.php, line 31

Class

MigrateResponsiveImageStylesTest
Tests migration of responsive image styles.

Namespace

Drupal\Tests\responsive_image\Kernel\Migrate\d7

Code

public function testResponsiveImageStyles() {
  $expected_image_style_mappings = [
    [
      'breakpoint_id' => 'responsive_image.computer',
      'multiplier' => 'multiplier_1',
      'image_mapping_type' => 'image_style',
      'image_mapping' => 'custom_image_style_1',
    ],
    [
      'breakpoint_id' => 'responsive_image.computer',
      'multiplier' => 'multiplier_2',
      'image_mapping_type' => 'sizes',
      'image_mapping' => [
        'sizes' => '2',
        'sizes_image_styles' => [
          'custom_image_style_1',
          'custom_image_style_2',
        ],
      ],
    ],
    [
      'breakpoint_id' => 'responsive_image.computertwo',
      'multiplier' => 'multiplier_2',
      'image_mapping_type' => 'sizes',
      'image_mapping' => [
        'sizes' => '2',
        'sizes_image_styles' => [
          'custom_image_style_1',
          'custom_image_style_2',
        ],
      ],
    ],
  ];
  $this
    ->assertSame($expected_image_style_mappings, ResponsiveImageStyle::load('narrow')
    ->getImageStyleMappings());
}