You are here

public function AdminSettingsFormTest::testPageTracking in Matomo Analytics 8

Tests the fields that allow to configure tracking of specific pages.

@dataProvider pageTrackingProvider

Parameters

string $pages: A list of pages that should be tracked. One page per line.

bool $validation_error_expected: TRUE if a validation error should be thrown. FALSE otherwise.

File

tests/src/Functional/AdminSettingsFormTest.php, line 58

Class

AdminSettingsFormTest
Tests the configuration form.

Namespace

Drupal\Tests\matomo\Functional

Code

public function testPageTracking($pages, $validation_error_expected) {
  $edit = [
    'matomo_visibility_request_path_mode' => 0,
    'matomo_visibility_request_path_pages' => $pages,
  ];
  $this
    ->drupalPostForm('admin/config/system/matomo', $edit, 'Save configuration');
  $has_validation_error = (bool) $this
    ->getSession()
    ->getPage()
    ->find('css', '#edit-matomo-visibility-request-path-pages.error');
  $this
    ->assertEquals($validation_error_expected, $has_validation_error);
}