initUserPreferenceWithDefault() public méthode

Sets a user preference in the DB using the preference's default value.
public initUserPreferenceWithDefault ( string $userLogin, string $preferenceName )
$userLogin string
$preferenceName string
Exemple #1
0
 public function test_initUserPreferenceWithDefault_ShouldNotSaveTheDefaultPreference_IfPreferenceIsAlreadySet()
 {
     // set value so there will already be a default
     Option::set($this->getPreferenceId(API::PREFERENCE_DEFAULT_REPORT), '999');
     $siteId = Option::get($this->getPreferenceId(API::PREFERENCE_DEFAULT_REPORT));
     $this->assertEquals('999', $siteId);
     $this->api->initUserPreferenceWithDefault($this->login, API::PREFERENCE_DEFAULT_REPORT);
     // make sure it did not save the preference
     $siteId = Option::get($this->getPreferenceId(API::PREFERENCE_DEFAULT_REPORT));
     $this->assertEquals('999', $siteId);
 }