You are here

public function ExcludeTestCase::testPathExclude in Image Lazyloader 8

Test functioning of the path exclude setting.

File

src/tests/ExcludeTestCase.php, line 39

Class

ExcludeTestCase
Tests Lazyloader's exclusion functionality.

Namespace

Drupal\lazyloader\Tests

Code

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