You are here

function LazyloaderExcludeTestCase::testPathExclude in Image Lazyloader 7.2

Test functioning of the path exclude setting.

File

tests/lazyloader_exclude.test, line 41

Class

LazyloaderExcludeTestCase
Tests Lazyloader's exclusion functionality.

Code

function testPathExclude() {
  $alias = $this->node->path['alias'];
  $this
    ->drupalGet($alias);
  $this
    ->assertLazyloaderEnabled();
  $edit['lazyloader_paths'] = $alias;
  $this
    ->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
  $this
    ->drupalGet($alias);
  $this
    ->assertLazyloaderEnabled(FALSE, 'Lazyloader disabled for disabled alias');
  $edit['lazyloader_paths'] = '*' . substr($alias, 2, 2) . '*';
  $this
    ->drupalPost("admin/config/media/lazyloader/exclude", $edit, t('Save configuration'));
  $this
    ->drupalGet($alias);
  $this
    ->assertLazyloaderEnabled(FALSE, 'Lazyloader disabled for disabled alias with wildcards');
  $this
    ->drupalGet("node/{$this->node->nid}");
  $this
    ->assertLazyloaderEnabled(FALSE, 'Lazyloader is also disabled on internal path if alias with wildcard matches ');
}