updated tests and other relevant code
This commit is contained in:
parent
8058b337d9
commit
c1e5294609
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once ROOT_DIR.'/controller/db/Database.php';
|
require_once ROOT_DIR.'/controller/db/Database.php';
|
||||||
|
require_once ROOT_DIR.'/model/forum/Reply.php';
|
||||||
class DBReply extends Database{
|
class DBReply extends Database{
|
||||||
static function createReply($uid, $threadID, $content){
|
static function createReply($uid, $threadID, $content){
|
||||||
$con = self::connectToDB();
|
$con = self::connectToDB();
|
||||||
@ -11,6 +11,19 @@ class DBReply extends Database{
|
|||||||
echo "$uid, $threadID, $content";
|
echo "$uid, $threadID, $content";
|
||||||
$query->execute();
|
$query->execute();
|
||||||
}
|
}
|
||||||
|
static function getAllReplies():array
|
||||||
|
{
|
||||||
|
$con = self::connectToDB();
|
||||||
|
$query = $con->prepare("SELECT * FROM reply WHERE id = :id");
|
||||||
|
$query->bindParam(":id", $id);
|
||||||
|
$query->execute();
|
||||||
|
$replyArray = [];
|
||||||
|
while ($result = $query->fetch(PDO::FETCH_BOTH)) {
|
||||||
|
$reply = new Reply($result['ID'], $result['thread_ID'], $result['users_ID'], $result['content'], $result['date_created']);
|
||||||
|
array_push($replyArray, $reply);
|
||||||
|
}
|
||||||
|
return $replyArray;
|
||||||
|
}
|
||||||
static function getReplyByID($id):array
|
static function getReplyByID($id):array
|
||||||
{
|
{
|
||||||
$con = self::connectToDB();
|
$con = self::connectToDB();
|
||||||
|
|||||||
16
dev_mvc/model/testactions/TA_TestDBReply.php
Normal file
16
dev_mvc/model/testactions/TA_TestDBReply.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
require_once(ROOT_DIR.'/controller/db/DBReply.php');
|
||||||
|
require_once(ROOT_DIR.'/model/forum/Reply.php');
|
||||||
|
class TA_TestDBReply extends TestAction{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
public function execute()
|
||||||
|
{
|
||||||
|
$replies = DBReply::getAllReplies();
|
||||||
|
echo "<div id='response_json'>";
|
||||||
|
echo (json_encode($replies));
|
||||||
|
echo "</div>";
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,10 +9,6 @@ class TA_TestDBUser extends TestAction{
|
|||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
$users = DBUser::getAllUsers();
|
$users = DBUser::getAllUsers();
|
||||||
|
|
||||||
foreach ($users as $user) {
|
|
||||||
$user->setReg_Date('1337-13-37 13:37:69');
|
|
||||||
}
|
|
||||||
echo "<div id='response_json'>";
|
echo "<div id='response_json'>";
|
||||||
echo (json_encode($users));
|
echo (json_encode($users));
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user