Beispiel #1
0
 public function testObjectPropertiesSet()
 {
     $id = 1;
     $title = "Title";
     $userlimit = 40;
     $password = "******";
     $queueid = 1;
     $room = new Room();
     $room->setId($id)->setPassword($password)->setTitle($title)->setUserLimit($userlimit)->setQueueId($queueid);
     $refRoom = new \ReflectionObject($room);
     $idProp = $refRoom->getProperty('_id');
     $idProp->setAccessible(true);
     $titleProp = $refRoom->getProperty('_title');
     $titleProp->setAccessible(true);
     $passwordProp = $refRoom->getProperty('_password');
     $passwordProp->setAccessible(true);
     $userlimitProp = $refRoom->getProperty('_userlimit');
     $userlimitProp->setAccessible(true);
     $queueIdProp = $refRoom->getProperty('_queueid');
     $queueIdProp->setAccessible(true);
     $this->assertEquals($id, $idProp->getValue($room), "ID not properly set by Room setter method.");
     $this->assertEquals($title, $titleProp->getValue($room), "Title not properly set by Room setter method.");
     $this->assertEquals($password, $passwordProp->getValue($room), "Password not properly set by Room setter method.");
     $this->assertEquals($userlimit, $userlimitProp->getValue($room), "Thumbsup not properly set by Room setter method.");
     $this->assertEquals($queueid, $queueIdProp->getValue($room), "Queue ID not properly set by Room setter method.");
 }
Beispiel #2
0
 /**
  * @param $id
  * @return Queue
  */
 public function fetchQueueByRoom(Room $room)
 {
     if (!$this->isQueueCached($room->getQueueId())) {
         $this->queues[$room->getQueueId()] = $this->_dataMapper->fetchQueueByRoom($room);
     }
     return $this->queues[$room->getQueueId()];
 }
    /**
     * @param Room
     * @return Queue
     */
    public function fetchQueueByRoom(Room $room)
    {
        $results = $this->_dbCon->query('SELECT * 
			FROM `queue` 
			WHERE `id` = ?', array($room->getId()));
        $row = $results->current();
        $queue = new Queue();
        $queue->setId($row['id']);
        return $queue;
    }
 /**
  * @param Room
  * @return void
  */
 public function deleteRoom(Room $room)
 {
     $statement = $this->_dbCon->query('DELETE FROM `room` WHERE `id` = ?', array($room->getId()));
 }
 public function makeDummyRoom($properties)
 {
     $room = new Room();
     $room->setId($properties['id'])->setPassword($properties['password'])->setTitle($properties['title'])->setUserLimit($properties['userlimit']);
     return $room;
 }