public function GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomDimensionsTokenFormValidation in Google Analytics 7.2
Tests if Custom Dimensions token form validation works.
File
- ./
googleanalytics.test, line 457 - Test file for Google Analytics module.
Class
Code
public function testGoogleAnalyticsCustomDimensionsTokenFormValidation() {
$ua_code = 'UA-123456-1';
// Check form validation.
$edit['googleanalytics_account'] = $ua_code;
$edit['googleanalytics_custom_dimension[indexes][1][value]'] = '[current-user:name]';
$edit['googleanalytics_custom_dimension[indexes][2][value]'] = '[current-user:edit-url]';
$edit['googleanalytics_custom_dimension[indexes][3][value]'] = '[user:name]';
$edit['googleanalytics_custom_dimension[indexes][4][value]'] = '[term:name]';
$edit['googleanalytics_custom_dimension[indexes][5][value]'] = '[term:tid]';
$this
->drupalPost('admin/config/system/googleanalytics', $edit, t('Save configuration'));
$this
->assertRaw(t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', array(
'%element-title' => t('Custom dimension value #@index', array(
'@index' => 1,
)),
'@invalid-tokens' => implode(', ', array(
'[current-user:name]',
)),
)));
$this
->assertRaw(t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', array(
'%element-title' => t('Custom dimension value #@index', array(
'@index' => 2,
)),
'@invalid-tokens' => implode(', ', array(
'[current-user:edit-url]',
)),
)));
$this
->assertRaw(t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', array(
'%element-title' => t('Custom dimension value #@index', array(
'@index' => 3,
)),
'@invalid-tokens' => implode(', ', array(
'[user:name]',
)),
)));
// BUG #2037595
//$this->assertNoRaw(t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', array('%element-title' => t('Custom dimension value #@index', array('@index' => 4)), '@invalid-tokens' => implode(', ', array('[term:name]')))));
//$this->assertNoRaw(t('The %element-title is using the following forbidden tokens with personal identifying information: @invalid-tokens.', array('%element-title' => t('Custom dimension value #@index', array('@index' => 5)), '@invalid-tokens' => implode(', ', array('[term:tid]')))));
}