protected function TestBase::assertLazyloaderEnabled in Image Lazyloader 8
Asserts if Lazyloader is enabled on the page.
Parameters
bool $enabled: Whether or not lazyloader should be enabled.
string $message: The message.
3 calls to TestBase::assertLazyloaderEnabled()
- ExcludeTestCase::testContentTypeExclude in src/
tests/ ExcludeTestCase.php - Tests functioning of the content type exclude settings.
- ExcludeTestCase::testImageStyleExclude in src/
tests/ ExcludeTestCase.php - Test functioning of the image style exclude setting.
- ExcludeTestCase::testPathExclude in src/
tests/ ExcludeTestCase.php - Test functioning of the path exclude setting.
File
- src/
tests/ TestBase.php, line 105
Class
- TestBase
- Test case for typical lazyloader tests.
Namespace
Drupal\lazyloader\TestsCode
protected function assertLazyloaderEnabled($enabled = TRUE, $message = '') {
if ($message === '') {
$message = $enabled ? 'Lazyloader is enabled' : 'Lazyloader is disabled';
}
$image_count = count($this->node->field_images[$this->node->language]);
$images = $this
->xpath('//img[@data-echo]');
if ($enabled) {
$this
->assertEquals(count($images), $image_count, $message);
}
else {
$this
->assertFalse(count($images), $message);
}
}