You are here

public function AdminSettingsFormTest::pageTrackingProvider in Matomo Analytics 8

Provides test data for ::testPageTracking().

Return value

array An array of test cases, each test case is an array with two values: 0. A string containing a list of pages to track. 1. A boolean indicating whether or not a validation error is expected to be thrown.

File

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

Class

AdminSettingsFormTest
Tests the configuration form.

Namespace

Drupal\Tests\matomo\Functional

Code

public function pageTrackingProvider() {

  // @codingStandardsIgnoreStart
  return [
    [
      // No validation error should be thrown for an empty page list.
      '',
      FALSE,
    ],
    [
      // No validation error should be thrown for a list of valid pages.
      <<<TXT
/node/1
/blog/*/view
/shop
<front>
TXT
,
      FALSE,
    ],
    [
      // A validation error should be thrown if one of the pages doesn't start
      // with a slash.
      <<<TXT
/node/1
/blog/*/view
shop
<front>
TXT
,
      TRUE,
    ],
  ];

  // @codingStandardsIgnoreEnd
}