public function testDelete()
 {
     $pictureMapper = new PictureMapper();
     $pictureMapper->setId(1);
     $pictureMapper->deletePicture();
     $this->assertEquals(new Picture(), $pictureMapper->selectPicture());
 }
             Rest::sendResponse(200, json_encode($pictureArray), 'application/json');
         } else {
             if ($http->getHttpAccept() == 'xml') {
                 $options = array('indent' => '     ', 'addDecl' => false, "defaultTagName" => "picture", XML_SERIALIZER_OPTION_RETURN_RESULT => true);
                 $serializer = new XML_Serializer($options);
                 Rest::sendResponse(200, $serializer->serialize($pictureArray), 'application/xml');
             }
         }
     } else {
         Rest::sendResponse(204);
     }
     break;
 case 'delete':
     $picture_ = new Picture();
     $pictureMapper = new \PictureMapper();
     if ($pictureMapper->deletePicture()) {
         Rest::sendResponse(200);
     }
     break;
 case 'put':
     try {
         $picture_ = new Picture();
         $data_picture_ = $http->getRequestVars();
         $pictureObject = initObject($data_picture_, $picture_, true);
         if (!emptyObject($pictureObject)) {
             $pictureMapper = new \PictureMapper();
             if ($pictureMapper->updatePicture($pictureObject)) {
                 Rest::sendResponse(200);
             }
         } else {
             throw new InvalidArgumentException('Need arguments to UPDATE data !');
 /**
  * Triggered 
  * @return Boolean If True -> Success Query / False -> Fail Query
  * @throws InvalidArgumentException
  */
 public function deleteAnnouncement()
 {
     try {
         if (is_null($this->table)) {
             throw new InvalidArgumentException('Attribute "table" can\'t be NULL !');
         }
         if (isset($this->id) && !is_null($this->id)) {
             $where = 'id = ' . $this->getId();
         }
         $pictureMapper = new PictureMapper($this);
         $pictures = $pictureMapper->selectPicture(true, 'id_announcement = ' . $this->getId());
         if (isset($pictures) && !empty($pictures)) {
             foreach ($pictures as $key => $value) {
                 $idPicture = $value->getId();
                 $path = $value->getPath();
                 $title = $value->getTitle();
                 $ext = $value->getExtension();
                 //Remove to the pictures folders
                 if (file_exists(UPLOAD_PATH . $path . $title . '.' . $ext)) {
                     unlink(UPLOAD_PATH . $path . $title . '.' . $ext);
                 }
                 //Remove to database
                 $pictureMapper = new PictureMapper();
                 $pictureMapper->setId($idPicture);
                 if ($pictureMapper->deletePicture()) {
                     continue;
                 } else {
                     throw new Exception('Problem on the delete picture query !');
                 }
             }
         }
         return parent::delete($this->table, $where);
     } catch (InvalidArgumentException $e) {
         print $e->getMessage();
         exit;
     } catch (Exception $e) {
         print $e->getMessage();
         exit;
     }
 }