You are here

public function PiwikCustomUrls::testPiwikUserPasswordPage in Piwik Web Analytics 7.2

Tests if user password page urls are overridden.

File

./piwik.test, line 341
Test file for Piwik module.

Class

PiwikCustomUrls
Test custom url functionality of Google Analytics module.

Code

public function testPiwikUserPasswordPage() {
  $base_path = base_path();
  $ua_code = '1';
  variable_set('piwik_site_id', $ua_code);
  variable_get('piwik_url_http', 'http://example.com/piwik/');
  variable_get('piwik_url_https', 'https://example.com/piwik/');
  $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", "', '[testPiwikCustomUrls]: Custom url not set.');
}