You are here

public function MatomoCustomUrls::testMatomoUserPasswordPage in Matomo Analytics 7.2

Tests if user password page urls are overridden.

File

./matomo.test, line 342
Test file for Matomo module.

Class

MatomoCustomUrls
Test custom url functionality of Matomo module.

Code

public function testMatomoUserPasswordPage() {
  $base_path = base_path();
  $ua_code = '1';
  variable_set('matomo_site_id', $ua_code);
  variable_get('matomo_url_http', 'http://example.com/matomo/');
  variable_get('matomo_url_https', 'https://example.com/matomo/');
  $this
    ->drupalGet('user/password', array(
    'query' => array(
      'name' => 'foo',
    ),
  ));
  $this
    ->assertRaw('_paq.push(["setCustomUrl", ' . drupal_json_encode(url('user/password')) . ']);');
  $this
    ->drupalGet('user/password', array(
    'query' => array(
      'name' => 'foo@example.com',
    ),
  ));
  $this
    ->assertRaw('_paq.push(["setCustomUrl", ' . drupal_json_encode(url('user/password')) . ']);');
  $this
    ->drupalGet('user/password');
  $this
    ->assertNoRaw('_paq.push(["setCustomUrl", "', '[testMatomoCustomUrls]: Custom url not set.');
}