Exemplo n.º 1
0
 /**
  * Return a list of locks.
  *
  * @return array
  */
 public function list_locks()
 {
     $result = $this->db_object->fetch_all('SELECT * FROM ' . $this->db_object->get_db_table_name(), array());
     $locks = array();
     if ($result) {
         foreach ($result as $result_item) {
             $locks[] = $this->build_lock_object($result_item);
         }
     }
     return $locks;
 }
Exemplo n.º 2
0
 /**
  * @param \Ingenerator\RunSingle\PdoDatabaseObject $db_object
  * @param string                                   $task_name
  * @param int                                      $lock_id
  */
 protected function givenOldLockToGarbageCollect($db_object, $task_name, $lock_id)
 {
     $db_object->fetch_all(self::SELECT_LOCK_SQL, array(':task_name' => self::TASK_NAME, ':current_timestamp' => self::FAKE_TIMESTAMP))->willReturn(array(array('task_name' => $task_name, 'lock_timestamp' => $lock_id, 'timeout' => 10, 'lock_holder' => self::FAKE_LOCK_HOLDER)));
     $db_object->execute(self::DELETE_LOCK_SQL, array(':task_name' => self::TASK_NAME, ':lock_timestamp' => self::FAKE_TIMESTAMP))->willReturn();
 }
 /**
  * @param \PDOStatement $q
  */
 function its_execute_executes_the_query($q)
 {
     $this->subject->execute(self::FAKE_SQL, array(':task_name' => self::TASK_NAME));
     $q->execute(array(':task_name' => self::TASK_NAME))->shouldHaveBeenCalled();
 }