예제 #1
0
 /**
  * Make sure that deleting a user preference actually works.
  * 
  * We're expecting the UserPreferenceNotFoundException because we are attempting to retrieve the value of the
  * previously deleted value.
  * 
  * @expectedException PartKeepr\UserPreference\Exceptions\UserPreferenceNotFoundException
  */
 public function testDeleteUserPreference()
 {
     $preferenceKey = "test3";
     $preferenceValue = "123";
     UserPreference::setPreference($this->user, $preferenceKey, $preferenceValue);
     UserPreference::deletePreference($this->user, $preferenceKey);
     // This one should give us the UserPreferenceNotFoundException
     UserPreference::getPreferenceValue($this->user, $preferenceKey);
 }
예제 #2
0
 /**
  * Returns a given preference value
  * 
  * @param string $preferenceKey The preference key
  * @return UserPreference The user preference object
  * @throws UserPreferenceNotFoundException If the preference key was not found
  * @throws EntityNotPersistantException		Thrown if the entity is not persistant
  */
 public function getPreferenceValue($preferenceKey)
 {
     return UserPreference::getPreferenceValue($this, $preferenceKey);
 }