You are here

public function CounterTest::testCounterCodeDefault in Yandex.Metrics 8.3

Test counter code with default module settings.

File

tests/src/Functional/CounterTest.php, line 99
Contains \Drupal\yandex_metrics\Tests\CounterTest.

Class

CounterTest
Tests of functionality and settings of Yandex.Metrics Counter module.

Namespace

Drupal\Tests\yandex_metrics\Functional

Code

public function testCounterCodeDefault() {

  // Login as administrator.
  $this
    ->drupalLogin($this->admin_user);
  $edit = array();
  $edit["counter_code"] = $this->yandex_metrics_code;
  $this
    ->drupalPostForm('admin/config/system/yandex_metrics', $edit, t('Save configuration'));
  $this
    ->drupalLogout();

  // Anonymous user.
  // Front page.
  $this
    ->drupalGet('node');
  $this
    ->checkCounter();

  // 404 page.
  $this
    ->drupalGet('404');
  $this
    ->checkCounter();

  // Administration page.
  $this
    ->drupalGet('admin');
  $this
    ->checkNoCounter();

  // Login as administrator.
  $this
    ->drupalLogin($this->admin_user);

  // Front page.
  $this
    ->drupalGet('node');
  $this
    ->checkCounter();

  // Administration page.
  $this
    ->drupalGet('admin/content');
  $this
    ->checkNoCounter();
}