public function ExcludeTestCase::testContentTypeExclude in Image Lazyloader 8
Tests functioning of the content type exclude settings.
File
- src/
tests/ ExcludeTestCase.php, line 17
Class
- ExcludeTestCase
- Tests Lazyloader's exclusion functionality.
Namespace
Drupal\lazyloader\TestsCode
public function testContentTypeExclude() {
// Test default rendering of a node.
$this
->drupalGet("node/{$this->node->nid}");
$this
->assertLazyloaderEnabled();
// Test rendering with content type exclusion enabled.
$edit['lazyloader_content_types[article]'] = 'article';
$this
->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
$this
->drupalGet("node/{$this->node->nid}");
$this
->assertLazyloaderEnabled(FALSE, 'Lazyloader is disabled for page nodes when limited to article content types.');
// Test rendering when the page type is supposed to be rendered.
$edit['lazyloader_content_types[article]'] = FALSE;
$edit['lazyloader_content_types[page]'] = 'page';
$this
->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
$this
->drupalGet("node/{$this->node->nid}");
$this
->assertLazyloaderEnabled(TRUE, 'Lazyloader is enabled for page nodes when limited to page content types.');
}