public function testDeleteAll() { $userTable = new UserModel(); $commentTable = new CommentModel(); $moodTable = new MoodListModel(); $userTable->deleteAll(); $comment = $commentTable->find(); $mood = $moodTable->find(); $user = $userTable->find(); $this->assertTrue($comment == null && $user == null && $mood == null); }
} else { $movieId = validateInput($_POST['movieId']); $comment = validateInput($_POST['comment']); if (array_key_exists('commentId', $_POST)) { $commentId = $_POST['commentId']; } } } else { throw new Exception("Error Processing Request", 1); } // Check if database is available CheckOrCreateDB(); if (!$delete) { // populating the data $co = new CommentModel(array('movie_id' => $movieId, 'comment' => $comment, 'id' => $commentId)); $co->save(); $response = array('id' => $co->id, 'message' => 'success!!'); } else { if ($delete) { // Actions for delete $co = CommentModel::find($commentId); if ($co->delete()) { $response = array('message' => 'success'); } else { $response = array('message' => 'some problems'); } } } $encoded = json_encode($response); header('Content-type: application/json'); exit($encoded);