public function OptimizelyTestDefaultSettingsCase::testOptimizelyDefaultSettings in Optimizely 7.2
Same name and namespace in other branches
- 7.3 optimizely.test \OptimizelyTestDefaultSettingsCase::testOptimizelyDefaultSettings()
File
- ./
optimizely.test, line 918 - Optimizely Tests
Class
- OptimizelyTestDefaultSettingsCase
- * Test if the default project settings work correctly.
Code
public function testOptimizelyDefaultSettings() {
// add the Optimizely account ID
$edit = array(
'optimizely_id' => rand(0, 10000),
);
$this
->drupalPost('admin/config/system/optimizely/settings', $edit, t('Submit'));
$optimizely_id = db_query('SELECT project_code FROM {optimizely} WHERE oid = 1')
->fetchField();
$this
->assertEqual($optimizely_id, $edit['optimizely_id'], t('Optimizely ID number added to Default project.'));
// enable the default project
$edit = array(
'optimizely_enabled' => 1,
);
$this
->drupalPost('admin/config/system/optimizely/add_update/1', $edit, t('Update'));
$enabled = db_query('SELECT enabled FROM {optimizely} WHERE oid = 1')
->fetchField();
$this
->assertEqual($enabled, $edit['optimizely_enabled'], t('The Default project was enabled.'));
// disable the default project
$edit = array(
'optimizely_enabled' => 0,
);
$this
->drupalPost('admin/config/system/optimizely/add_update/1', $edit, t('Update'));
$enabled = db_query('SELECT enabled FROM {optimizely} WHERE oid = 1')
->fetchField();
$this
->assertEqual($enabled, $edit['optimizely_enabled'], t('The Default project was disabled.'));
}