X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv3%2FSettingTest.php;h=3ba00895887ddf7a3fa219810c2b88b4f675a35d;hb=b94eea5170f9b25e817067941198129b5de3224c;hp=5727487e15b8bcd93df2a8daf00b32f0311dc07c;hpb=dfc3d2e798940e3837e842e41e3d16a009760764;p=civicrm-core.git diff --git a/tests/phpunit/api/v3/SettingTest.php b/tests/phpunit/api/v3/SettingTest.php index 5727487e15..3ba0089588 100644 --- a/tests/phpunit/api/v3/SettingTest.php +++ b/tests/phpunit/api/v3/SettingTest.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2017 | + | Copyright CiviCRM LLC (c) 2004-2018 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -527,4 +527,27 @@ class api_v3_SettingTest extends CiviUnitTestCase { $this->assertEquals('Unconfirmed', $result['values'][$dom['id']]['tag_unconfirmed']); } + /** + * Test to set isProductionEnvironment + * + */ + public function testSetCivicrmEnvironment() { + $params = array( + 'environment' => 'Staging', + ); + $result = $this->callAPISuccess('Setting', 'create', $params); + $params = array( + 'name' => 'environment', + 'group' => 'Developer Preferences', + ); + $result = $this->callAPISuccess('Setting', 'getvalue', $params); + $this->assertEquals('Staging', $result); + + global $civicrm_setting; + $civicrm_setting[CRM_Core_BAO_Setting::DEVELOPER_PREFERENCES_NAME]['environment'] = 'Production'; + Civi::service('settings_manager')->useMandatory(); + $result = $this->callAPISuccess('Setting', 'getvalue', $params); + $this->assertEquals('Production', $result); + } + }