public function ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMappings in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMappings()
@covers ::addImageStyleMapping @covers ::getImageStyleMappings
File
- core/
modules/ responsive_image/ tests/ src/ Unit/ ResponsiveImageStyleConfigEntityUnitTest.php, line 284 - Contains \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest.
Class
- ResponsiveImageStyleConfigEntityUnitTest
- @coversDefaultClass \Drupal\responsive_image\Entity\ResponsiveImageStyle @group block
Namespace
Drupal\Tests\responsive_image\UnitCode
public function testGetImageStyleMappings() {
$entity = new ResponsiveImageStyle(array(
'',
));
$entity
->addImageStyleMapping('test_breakpoint', '1x', array(
'image_mapping_type' => 'image_style',
'image_mapping' => 'large',
));
$entity
->addImageStyleMapping('test_breakpoint', '2x', array(
'image_mapping_type' => 'sizes',
'image_mapping' => array(
'sizes' => '(min-width:700px) 700px, 100vw',
'sizes_image_styles' => array(
'large' => 'large',
),
),
));
$entity
->addImageStyleMapping('test_breakpoint2', '1x', array(
'image_mapping_type' => 'image_style',
'image_mapping' => 'thumbnail',
));
$expected = array(
array(
'breakpoint_id' => 'test_breakpoint',
'multiplier' => '1x',
'image_mapping_type' => 'image_style',
'image_mapping' => 'large',
),
array(
'breakpoint_id' => 'test_breakpoint',
'multiplier' => '2x',
'image_mapping_type' => 'sizes',
'image_mapping' => array(
'sizes' => '(min-width:700px) 700px, 100vw',
'sizes_image_styles' => array(
'large' => 'large',
),
),
),
array(
'breakpoint_id' => 'test_breakpoint2',
'multiplier' => '1x',
'image_mapping_type' => 'image_style',
'image_mapping' => 'thumbnail',
),
);
$this
->assertEquals($expected, $entity
->getImageStyleMappings());
}