public function YandexMetricsCounterTestCase::testCounterCodePagesSettings in Yandex.Metrics 7.3
Same name and namespace in other branches
- 7.2 yandex_metrics.test \YandexMetricsCounterTestCase::testCounterCodePagesSettings()
Test Yandex.Metrics page specific settings.
File
- ./
yandex_metrics.test, line 113 - Tests for Yandex.Metrics Counter module.
Class
- YandexMetricsCounterTestCase
- Tests of functionality and settings of Yandex.Metrics Counter module.
Code
public function testCounterCodePagesSettings() {
// Login as administrator.
$this
->drupalLogin($this->admin_user);
// Create test node.
$node = $this
->drupalCreateNode();
// Check if counter exists.
$this
->drupalGet('node');
$this
->checkCounter();
$this
->drupalGet('node/' . $node->nid);
$this
->checkCounter();
// Disable counter on node overview and node full pages.
$edit = array();
$edit["yandex_metrics_pages"] = variable_get('yandex_metrics_pages', YANDEX_METRICS_PAGES) . "\n" . 'node' . "\n" . 'node/*';
$this
->drupalPost('admin/config/system/yandex_metrics', $edit, t('Save'));
// Check if counter doesn't exist.
$this
->drupalGet('node');
$this
->checkNoCounter();
$this
->drupalGet('node/' . $node->nid);
$this
->checkNoCounter();
// Enable counter only on node pages.
$edit = array();
$edit['yandex_metrics_visibility'] = 1;
$edit['yandex_metrics_pages'] = 'node/*';
$this
->drupalPost('admin/config/system/yandex_metrics', $edit, t('Save'));
// Check if counter exists.
$this
->drupalGet('node/' . $node->nid);
$this
->checkCounter();
// Check if counter doesn't exist.
$this
->drupalGet('');
$this
->checkNoCounter();
$this
->drupalGet('user');
$this
->checkNoCounter();
}