You are here

public function ResponsiveImageTest::testSingleImageWithDensity in Image Lazyloader 8

@covers ::count @covers ::parse

File

tests/src/Unit/ResponsiveImageTest.php, line 42

Class

ResponsiveImageTest
@coversDefaultClass \Drupal\lazyloader\ResponsiveImage @group lazyloader

Namespace

Drupal\Tests\lazyloader\Unit

Code

public function testSingleImageWithDensity() {
  $string = 'mall.jpg 2x';
  $image = ResponsiveImage::parse($string);
  $this
    ->assertCount(1, $image);
  $this
    ->assertEquals('mall.jpg', $image
    ->get(0)->uri);
  $this
    ->assertNull($image
    ->get(0)->width);
  $this
    ->assertEquals('2', $image
    ->get(0)->density);
  $this
    ->assertEquals($string, $image
    ->__toString());
  return $image;
}