コード例 #1
0
ファイル: tweet-test.php プロジェクト: jfindley2/data-design
 /**
  * test grabbing a Tweet that does not exist
  **/
 public function testGetInvalidTweetByTweetId()
 {
     // grab a profile id that exceeds the maximum allowable profile id
     $tweet = Tweet::getTweetByTweetId($this->getPDO(), DataDesignTest::INVALID_KEY);
     $this->assertNull($tweet);
 }
コード例 #2
0
ファイル: index.php プロジェクト: ericdebelak/angular-mvc
                }
                $tweet->setProfileId($requestObject->profileId);
                $tweet->setTweetContent($requestObject->tweetContent);
                $tweet->setTweetDate($requestObject->tweetDate);
                if (empty($id) === true || $id < 0) {
                    $tweet->insert($pdo);
                    $reply->data = "Tweet created OK";
                } else {
                    $tweet->update($pdo);
                    $reply->data = "Tweet updated OK";
                }
                // delete an existing Tweet
            } else {
                if ($method === "DELETE") {
                    verifyXsrf();
                    $tweet = Tweet::getTweetByTweetId($pdo, $id);
                    $tweet->delete($pdo);
                    $reply->data = "Tweet deleted OK";
                }
            }
        }
    }
    // create an exception to pass back to the RESTful caller
} catch (Exception $exception) {
    $reply->status = $exception->getCode();
    $reply->data = $exception->getMessage();
}
if ($format === "json") {
    header("Content-type: application/json");
    echo json_encode($reply);
} else {