diff --git a/admin/inc/class.admin_cmd_edit_preferences.inc.php b/admin/inc/class.admin_cmd_edit_preferences.inc.php index 2014d0e098..0d6613a589 100644 --- a/admin/inc/class.admin_cmd_edit_preferences.inc.php +++ b/admin/inc/class.admin_cmd_edit_preferences.inc.php @@ -74,7 +74,7 @@ class admin_cmd_edit_preferences extends admin_cmd if ($check_only) return; - $prefs = new Api\Preferences(in_array($this->pref, 'default', 'forced') ? $this->pref : $this->account); + $prefs = new Api\Preferences(in_array($this->pref, array('default', 'forced')) ? $this->pref : $this->account); $prefs->read_repository(); foreach($this->set as $name => $value) { diff --git a/admin/tests/PreferencesCommandTest.php b/admin/tests/PreferencesCommandTest.php index 8da7ed9b7e..a15ce8a828 100644 --- a/admin/tests/PreferencesCommandTest.php +++ b/admin/tests/PreferencesCommandTest.php @@ -72,7 +72,8 @@ class PreferencesCommandTest extends CommandBase $this->assertArrayHasKey($this->preference_name, $post[static::APP]); $this->assertEquals($set[$this->preference_name], $post[static::APP][$this->preference_name]); // At type level - $this->assertArrayHasKey($this->preference_name, (Array)$post_pref->$type[static::APP]); + $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + "$type preferences does not have {$this->preference_name}"); $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); @@ -119,7 +120,8 @@ class PreferencesCommandTest extends CommandBase $this->assertEquals($set[$this->preference_name], $post[static::APP][$this->preference_name]); // At type level - $this->assertArrayHasKey($this->preference_name, (Array)$post_pref->$type[static::APP]); + $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + "$type preferences does not have {$this->preference_name}"); $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); @@ -168,7 +170,8 @@ class PreferencesCommandTest extends CommandBase ); // At type level - $this->assertArrayHasKey($this->preference_name, (Array)$post_pref->$type[static::APP]); + $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + "$type preferences does not have {$this->preference_name}"); $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); @@ -213,7 +216,8 @@ class PreferencesCommandTest extends CommandBase $post = $post_pref->read_repository(false); // At type level - should always be what we set - $this->assertArrayHasKey($this->preference_name, (Array)$post_pref->$type[static::APP]); + $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + "$type preferences does not have {$this->preference_name}"); $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); // At user level - depends on type priority