You are here

public function ResponsiveImageTest::testSingleImage in Image Lazyloader 8

@covers ::count @covers ::parse

File

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

Class

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

Namespace

Drupal\Tests\lazyloader\Unit

Code

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