public function OptimizelyTestDefaultProjectTestCase::testOptimizelyTestDefaultProjectSettings in Optimizely 7.3
Same name and namespace in other branches
- 7.2 optimizely.test \OptimizelyTestDefaultProjectTestCase::testOptimizelyTestDefaultProjectSettings()
File
- ./
optimizely.test, line 248 - Optimizely Tests
Class
- OptimizelyTestDefaultProjectTestCase
- OptimizelyTestDefaultProjectTestCase: Test that:
Code
public function testOptimizelyTestDefaultProjectSettings() {
// Access with privileged user
$this
->drupalLogin($this->privileged_user);
// Access general module settings page
$this
->drupalGet('admin/config/system/optimizely/settings');
// Check for blank setting (default)
$this
->assertFieldByName('optimizely_id', NULL, '** <strong>The Optimizely ID field is blank</strong> on Settings page: admin/config/system/optimizely/settings');
// Add Optimizely account setting
$this->optimizely_account_id = rand(1000000, 9999999);
$edit = array(
'optimizely_id' => $this->optimizely_account_id,
);
$this
->drupalPost('admin/config/system/optimizely/settings', $edit, t('Submit'));
$this
->drupalGet('/admin/config/system/optimizely');
// Check that the newly entered Optimizely ID is now listed as the project ID for the Default project
$this
->assertRaw('<td class="project-code-column disabled">' . $this->optimizely_account_id . '</td>', '** <strong>Default project is using the Optimizely account setting for project ID -> ' . $this->optimizely_account_id . '.</strong>');
// Access add / edit project page for default project
$this
->drupalGet('/admin/config/system/optimizely/add_update/1');
// Check the project ID setting matches the Optimizely Account ID setting.
$this
->assertFieldByName('optimizely_project_code', $this->optimizely_account_id, '** <strong>The Optimizely Project Code matches the Optimizely account ID setting.</strong>');
// Enable the Default project
$edit = array(
'optimizely_enabled' => 1,
);
$this
->drupalPost('/admin/config/system/optimizely/add_update/1', $edit, t('Update'));
// Go to project listings page
$this
->drupalGet('admin/config/system/optimizely');
// Confirm default project *is* enabled
$this
->assertRaw('<input id="project-enable-1" name="project-1" checked="checked" type="checkbox" value="1" class="form-checkbox" />', '** <strong>Default project *is* enabled on project listing page.</strong>');
$this
->drupalLogout();
}