function PiwikBasicTest::testPiwikConfiguration in Piwik Web Analytics 7.2
Same name and namespace in other branches
- 6.2 piwik.test \PiwikBasicTest::testPiwikConfiguration()
File
- ./piwik.test, line 39
- Test file for Piwik module.
Class
- PiwikBasicTest
- @file
Test file for Piwik module.
Code
function testPiwikConfiguration() {
$this
->drupalGet('admin/config/system/piwik');
$this
->assertRaw(t('Piwik site ID'), '[testPiwikConfiguration]: Settings page displayed.');
$edit['piwik_site_id'] = $this
->randomName(2);
$this
->drupalPost('admin/config/system/piwik', $edit, 'Save configuration');
$this
->assertRaw(t('A valid Piwik site ID is an integer only.'), '[testPiwikConfiguration]: Invalid Piwik site ID number validated.');
$this
->assertFieldByName('piwik_codesnippet_before');
$this
->assertFieldByName('piwik_codesnippet_after');
$this
->assertNoFieldByXPath("//textarea[@name='piwik_codesnippet_before' and @disabled='disabled']", NULL, '"Code snippet (before)" is enabled.');
$this
->assertNoFieldByXPath("//textarea[@name='piwik_codesnippet_after' and @disabled='disabled']", NULL, '"Code snippet (after)" is enabled.');
$this
->drupalLogin($this->noSnippetUser);
$this
->drupalGet('admin/config/system/piwik');
$this
->assertFieldByName('piwik_codesnippet_before');
$this
->assertFieldByName('piwik_codesnippet_after');
$this
->assertFieldByXPath("//textarea[@name='piwik_codesnippet_before' and @disabled='disabled']", NULL, '"Code snippet (before)" is disabled.');
$this
->assertFieldByXPath("//textarea[@name='piwik_codesnippet_after' and @disabled='disabled']", NULL, '"Code snippet (after)" is disabled.');
}