Example #1
0
 public function testGetAndSetNotifications()
 {
     $this->user->setNotifications(true);
     $this->assertEquals(true, $this->user->getNotifications());
 }
Example #2
0
 /**
  *
  * @param unknown_type $rs
  */
 private static function _getObject($rs)
 {
     $ret = new User();
     $ret->setAvatar($rs->getAvatar());
     $ret->setCos($rs->getCos());
     $ret->setCreationDate($rs->getCreationDate());
     $ret->setEmail($rs->getEmail());
     $ret->setEnabled($rs->getEnabled());
     $ret->setId($rs->getId());
     $ret->setName($rs->getName());
     $ret->setUsername($rs->getUsername());
     //
     // The following is a workaround on the fact that the translation of this
     // serialized object to the database gets all broken, due to the fact of PHP
     // introducing NULL bytes around the '*' that is prepended before protected
     // variable members, in the serialized mode. This method replaces those
     // problematic NULL bytes with an identifier string '~~NULL_BYTE~~',
     // rendering serialization and unserialization of these specific kinds of
     // object safe. Credits to travis@travishegner.com on:
     // http://pt.php.net/manual/en/function.serialize.php#96504
     //
     $unsafeSerializedNotifications = str_replace(CINTIENT_NULL_BYTE_TOKEN, "", $rs->getNotifications());
     if (($notifications = unserialize($unsafeSerializedNotifications)) === false) {
         $notifications = array();
     }
     $ret->setNotifications($notifications);
     $ret->resetSignature();
     return $ret;
 }