function GoogleAnalyticsBasicTest::testGoogleAnalyticsConfiguration in Google Analytics 7.2
Same name and namespace in other branches
- 6.4 googleanalytics.test \GoogleAnalyticsBasicTest::testGoogleAnalyticsConfiguration()
- 6.3 googleanalytics.test \GoogleAnalyticsBasicTest::testGoogleAnalyticsConfiguration()
- 7 googleanalytics.test \GoogleAnalyticsBasicTest::testGoogleAnalyticsConfiguration()
File
- ./googleanalytics.test, line 41
- Test file for Google Analytics module.
Class
- GoogleAnalyticsBasicTest
- @file
Test file for Google Analytics module.
Code
function testGoogleAnalyticsConfiguration() {
$this
->drupalGet('admin/modules');
$this
->assertRaw('admin/config/system/googleanalytics', '[testGoogleAnalyticsConfiguration]: Configure link from Modules page to Google Analytics Settings page exists.');
$this
->drupalGet('admin/reports/status');
$this
->assertRaw('admin/config/system/googleanalytics', '[testGoogleAnalyticsConfiguration]: Configure link from Status Reports page to Google Analytics Settings page exists.');
$this
->drupalGet('admin/config/system/googleanalytics');
$this
->assertRaw(t('Web Property ID'), '[testGoogleAnalyticsConfiguration]: Settings page displayed.');
$edit['googleanalytics_account'] = $this
->randomName(2);
$this
->drupalPost('admin/config/system/googleanalytics', $edit, t('Save configuration'));
$this
->assertRaw(t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.'), '[testGoogleAnalyticsConfiguration]: Invalid Web Property ID number validated.');
$this
->assertFieldByName('googleanalytics_codesnippet_create');
$this
->assertFieldByName('googleanalytics_codesnippet_before');
$this
->assertFieldByName('googleanalytics_codesnippet_after');
$this
->assertNoFieldByXPath("//textarea[@name='googleanalytics_codesnippet_create' and @disabled='disabled']", NULL, '"Create only fields" is enabled.');
$this
->assertNoFieldByXPath("//textarea[@name='googleanalytics_codesnippet_before' and @disabled='disabled']", NULL, '"Code snippet (before)" is enabled.');
$this
->assertNoFieldByXPath("//textarea[@name='googleanalytics_codesnippet_after' and @disabled='disabled']", NULL, '"Code snippet (after)" is enabled.');
$this
->drupalLogin($this->noSnippetUser);
$this
->drupalGet('admin/config/system/googleanalytics');
$this
->assertFieldByName('googleanalytics_codesnippet_create');
$this
->assertFieldByName('googleanalytics_codesnippet_before');
$this
->assertFieldByName('googleanalytics_codesnippet_after');
$this
->assertNoFieldByXPath("//textarea[@name='googleanalytics_codesnippet_create' and @disabled='disabled']", NULL, '"Create only fields" is enabled.');
$this
->assertFieldByXPath("//textarea[@name='googleanalytics_codesnippet_before' and @disabled='disabled']", NULL, '"Code snippet (before)" is disabled.');
$this
->assertFieldByXPath("//textarea[@name='googleanalytics_codesnippet_after' and @disabled='disabled']", NULL, '"Code snippet (after)" is disabled.');
}