Fixed Setting::getValue issue where defaults were not returned for single keys
- updated static strings with constants
This commit is contained in:
@ -47,7 +47,7 @@ class SettingTest extends MailPoetTest {
|
||||
->equals($default_settings['signup_confirmation']);
|
||||
}
|
||||
|
||||
function testItReturnsDefaultValueIfNotSet() {
|
||||
function testItCanSetAndGetValues() {
|
||||
// try to get an "unknown" key
|
||||
$setting = Setting::getValue('unknown_key', 'default_value');
|
||||
expect($setting)->equals('default_value');
|
||||
@ -69,6 +69,26 @@ class SettingTest extends MailPoetTest {
|
||||
expect($setting)->equals('default_value');
|
||||
}
|
||||
|
||||
function testItShouldReturnDefaultsSetInModelIfNotSet() {
|
||||
// model specified default settings
|
||||
$default_settings = Setting::getDefaults();
|
||||
|
||||
// try to get the MTA settings (which don't exist in the database)
|
||||
$mta_settings = Setting::getValue('mta');
|
||||
expect($mta_settings)->equals($default_settings['mta']);
|
||||
}
|
||||
|
||||
function testItShouldReturnCustomDefaultsInsteadOfDefaultsSetInModel() {
|
||||
// try to get the MTA settings (which don't exist in the database)
|
||||
// but specify a custom default value
|
||||
$custom_mta_settings = Setting::getValue('mta', array(
|
||||
'custom_default' => 'value'
|
||||
));
|
||||
expect($custom_mta_settings)->equals(array(
|
||||
'custom_default' => 'value'
|
||||
));
|
||||
}
|
||||
|
||||
function testItCanCreateOrUpdate() {
|
||||
$data = array(
|
||||
'name' => 'new',
|
||||
|
Reference in New Issue
Block a user