function ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMapping

Same name and namespace in other branches
  1. 8.9.x core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMapping()
  2. 10 core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMapping()
  3. 11.x core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php \Drupal\Tests\responsive_image\Unit\ResponsiveImageStyleConfigEntityUnitTest::testGetImageStyleMapping()

@covers ::addImageStyleMapping @covers ::getImageStyleMapping

File

core/modules/responsive_image/tests/src/Unit/ResponsiveImageStyleConfigEntityUnitTest.php, line 174

Class

ResponsiveImageStyleConfigEntityUnitTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21responsive_image%21src%21Entity%21ResponsiveImageStyle.php/class/ResponsiveImageStyle/9" title="Defines the responsive image style entity." class="local">\Drupal\responsive_image\Entity\ResponsiveImageStyle</a> @group block

Namespace

Drupal\Tests\responsive_image\Unit

Code

public function testGetImageStyleMapping() {
    $entity = new ResponsiveImageStyle([
        '',
    ]);
    $entity->addImageStyleMapping('test_breakpoint', '1x', [
        'image_mapping_type' => 'image_style',
        'image_mapping' => 'large',
    ]);
    $expected = [
        'breakpoint_id' => 'test_breakpoint',
        'multiplier' => '1x',
        'image_mapping_type' => 'image_style',
        'image_mapping' => 'large',
    ];
    $this->assertEquals($expected, $entity->getImageStyleMapping('test_breakpoint', '1x'));
    $this->assertNull($entity->getImageStyleMapping('test_unknown_breakpoint', '1x'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.