public function BlazyManagerUnitTest::testGetBlazy in Blazy 8.2
Tests for \Drupal\blazy\BlazyManager::getBlazy().
@covers ::getBlazy @dataProvider providerTestGetBlazy
File
- tests/
src/ Unit/ BlazyManagerUnitTest.php, line 105
Class
- BlazyManagerUnitTest
- @coversDefaultClass \Drupal\blazy\BlazyManager
Namespace
Drupal\Tests\blazy\UnitCode
public function testGetBlazy($uri, $content, $expected_image, $expected_render) {
$build = [];
$build['item'] = NULL;
$build['content'] = $content;
$build['settings']['uri'] = $uri;
$theme = [
'#theme' => 'blazy',
'#build' => [],
];
$this->blazyManager
->expects($this
->any())
->method('getBlazy')
->willReturn($expected_image ? $theme : []);
$image = $this->blazyManager
->getBlazy($build);
$check_image = !$expected_image ? empty($image) : !empty($image);
$this
->assertTrue($check_image);
}