/** * Makes sure that an exception is thrown when attempting to get a preference if the user is not persistant yet. * * @expectedException PartKeepr\Util\Exceptions\EntityNotPersistantException */ public function testGetNonPersistantUserPreference() { $user = new User(); UserPreference::getPreference($user, "test"); }
/** * Returns a given preference object * * @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 getPreference($preferenceKey) { return UserPreference::getPreference($this, $preferenceKey); }