public static function getMessage($message_id)
 {
     global $wpdb;
     if ("integer" != gettype($message_id)) {
         throw new InvalidArgumentException();
     }
     $getAutoresponderMessageRecordQuery = sprintf("SELECT * FROM {$wpdb->prefix}wpr_autoresponder_messages WHERE id=%d", $message_id);
     $results = $wpdb->get_results($getAutoresponderMessageRecordQuery);
     if (0 == count($results)) {
         throw new NonExistentMessageException();
     }
     $autoresponderId = $results[0]->aid;
     if (!Autoresponder::whetherAutoresponderExists(intval($autoresponderId))) {
         throw new NonExistentAutoresponderException();
     }
     $message = new AutoresponderMessage($results[0]);
     return $message;
 }
 public function testDeleteAutoresponderDeletesIntendedAutoresponder()
 {
     global $wpdb;
     $autoresponder_id = 1;
     $addAutoresponderQuery = sprintf("INSERT INTO {$wpdb->prefix}wpr_autoresponders (`nid`, `id`, `name`) VALUES (%d,%d, 'Test Autoresponder')", $this->newsletterId, $autoresponder_id);
     $wpdb->query($addAutoresponderQuery);
     $addAutoresponderQuery = sprintf("INSERT INTO {$wpdb->prefix}wpr_autoresponders (`nid`, `id`, `name`) VALUES (%d,%d, 'Test Autoresponder2')", $this->newsletterId, 2);
     $wpdb->query($addAutoresponderQuery);
     $this->assertTrue(Autoresponder::whetherAutoresponderExists($autoresponder_id));
     $this->assertTrue(Autoresponder::whetherAutoresponderExists(2));
     Autoresponder::delete(Autoresponder::getAutoresponder($autoresponder_id));
     $this->assertFalse(Autoresponder::whetherAutoresponderExists($autoresponder_id));
     $this->assertTrue(Autoresponder::whetherAutoresponderExists(2));
 }