You are here

function LazyloaderExcludeTestCase::testContentTypeExclude in Image Lazyloader 7.2

Tests functioning of the content type exclude settings.

File

tests/lazyloader_exclude.test, line 19

Class

LazyloaderExcludeTestCase
Tests Lazyloader's exclusion functionality.

Code

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.');
}