コード例 #1
0
 /**
  * test creating a Favorite and then deleting it
  **/
 public function testDeleteValidFavorite()
 {
     // count the number of rows and save it for later
     $numRows = $this->getConnection()->getRowCount("favorite");
     // create a new Favorite and insert to into mySQL
     $favorite = new Favorite($this->tweet->getTweetId(), $this->profile->getProfileId(), $this->VALID_FAVORITEDATE);
     $favorite->insert($this->getPDO());
     // delete the Favorite from mySQL
     $this->assertEquals($numRows + 1, $this->getConnection()->getRowCount("favorite"));
     $favorite->delete($this->getPDO());
     // grab the data from mySQL and enforce the Tweet does not exist
     $pdoFavorite = Favorite::getFavoriteByTweetIdAndProfileId($this->getPDO(), $this->tweet->getTweetId(), $this->profile->getProfileId());
     $this->assertNull($pdoFavorite);
     $this->assertEquals($numRows, $this->getConnection()->getRowCount("favorite"));
 }
コード例 #2
0
ファイル: services.php プロジェクト: vinoth4891/clinique
 private function __remove()
 {
     require_once 'favorite.php';
     $bookmarkurl = required_param('bookmarkurl', PARAM_RAW_TRIMMED);
     $title = required_param('title', PARAM_RAW_TRIMMED);
     $userid = self::get_user_id();
     Favorite::delete($userid, $bookmarkurl, $title);
 }
コード例 #3
0
ファイル: degree_controller.php プロジェクト: nopomi/abinet
 public static function delete($id)
 {
     if (self::get_user_admin() == null) {
         Redirect::to('/home');
     }
     $favorites = Favorite::findByDegree($id);
     foreach ($favorites as $favorite) {
         Favorite::delete($favorite->applicant_id, $favorite->degree_id);
     }
     $degree = Degree::find($id);
     $degree->delete();
     Redirect::to('/degrees', array('message' => 'Degree deleted!'));
 }
コード例 #4
0
ファイル: favorite_controller.php プロジェクト: nopomi/abinet
 public static function remove($degree_id)
 {
     $user = self::get_user_logged_in();
     Favorite::delete($user->id, $degree_id);
     Redirect::to('/search', array('message' => 'Favorite removed!'));
 }
コード例 #5
0
    $favoriteDAO = new Favorite();
    $favoriteDAO->insert($favorite);
    echo '{"result":"ok"}';
});
$app->put('/favorite', function () {
    $request = \Slim\Slim::getInstance()->request();
    $favorite = json_decode($request->getBody());
    $favoriteDAO = new Favorite();
    $favoriteDAO->update($favorite);
    echo '{"result":"ok"}';
});
$app->delete('/favorite', function () {
    $request = \Slim\Slim::getInstance()->request();
    $favorite = json_decode($request->getBody());
    $favoriteDAO = new Favorite();
    $favoriteDAO->delete($favorite);
    echo '{"result":"ok"}';
});
$app->get('/user', function () {
    $userDAO = new User();
    $result = $userDAO->get();
    echo json_encode($result);
});
$app->post('/user', function () {
    $request = \Slim\Slim::getInstance()->request();
    $user = json_decode($request->getBody());
    $userDAO = new User();
    $userDAO->insert($user);
    echo '{"result":"ok"}';
});
$app->put('/user', function () {