Exemple #1
0
 /**
  * @covers Artist::delete
  */
 public function testDelete()
 {
     $this->object->id = 'alpha';
     $this->assertFalse($this->object->delete(), 'Artist should not be deleted');
     $this->object->id = null;
     $this->assertFalse($this->object->delete(), 'Artist should not be deleted');
     $this->object->id = 2;
     $this->assertTrue($this->object->delete(), 'Artist should be deleted');
 }
Exemple #2
0
     if (!$api->checkAuth()) {
         //User not authentified/authorized
         return;
     }
     if (!$api->checkScope('admin')) {
         $api->output(403, 'Admin scope is required for deleting artist');
         //indicate the requester do not have the required scope for deleting artist
         return;
     }
     if (!$api->checkParameterExists('id', $id)) {
         $api->output(400, 'Artist identifier must be provided');
         //artist was not provided, return an error
         return;
     }
     $artist = new Artist($id);
     if (!$artist->delete()) {
         $api->output(500, 'Error during artist deletion');
         //something gone wrong :(
         return;
     }
     $api->output(204, null);
     break;
 case 'PUT':
     //update artist
     if (!$api->checkAuth()) {
         //User not authentified/authorized
         return;
     }
     if (!$api->checkScope('admin')) {
         $api->output(403, 'Admin scope is required for editing artist');
         //indicate the requester do not have the required scope for updating artist
        $data = $data . $date . "," . $row[4] . "," . $row[5] . ";";
    }
    $stmt->closeCursor();
    $data = convertToUTF8($data);
    echo $data;
}
//partie suppression
if (isset($_GET['action']) && $_GET['action'] == 1) {
    $notarizealbum = new Notarizealbum($_GET['user'], $_GET['id']);
    $notarizealbum->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['action']) && $_GET['action'] == 2) {
    $notarizeartist = new Notarizeartist($_GET['user'], $_GET['id']);
    $notarizeartist->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['action']) && $_GET['action'] == 3) {
    $comment = new Comment($_GET['user'], $_GET['id']);
    $comment->delete($_GET['user'], $_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'artist') {
    $artist = new Artist($_GET['id']);
    $artist->delete($_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'album') {
    $album = new Album($_GET['id']);
    $album->delete($_GET['id']);
}
if (isset($_GET['type']) && $_GET['type'] == 'song') {
    $song = new Song($_GET['id']);
    $song->delete($_GET['id']);
}