You are here

public function GoogleAnalyticsBasicTest::testGoogleAnalytics in Google Analytics 6.2

Same name and namespace in other branches
  1. 6 tests/googleanalytics_basic.test \GoogleAnalyticsBasicTest::testGoogleAnalytics()

File

tests/googleanalytics_basic.test, line 27
Test file for Google Analytics module.

Class

GoogleAnalyticsBasicTest
@file Test file for Google Analytics module.

Code

public function testGoogleAnalytics() {

  // Check for setting page's presence.
  $this
    ->drupalGet('admin/settings/googleanalytics');
  $this
    ->assertRaw(t('Google Analytics account number'), '[testGoogleAnalytics]: Settings page displayed.');

  // Check for account code validation.
  $edit['googleanalytics_account'] = $this
    ->randomName(2);
  $this
    ->drupalPost('admin/settings/googleanalytics', $edit, 'Save configuration');
  $this
    ->assertRaw(t('A valid Google Analytics account number is case sensitive and formatted like UA-xxxxxx-x.'), '[testGoogleAnalytics]: Invalid account number validated.');
}