public function testPut() { $picture = new Picture(); $picture->setId(1); $picture->setTitle('announcement_1_1'); $picture->setPath('/announcement/original/'); $picture->setAlternative('Un texte alternatif modifié'); $picture->setIdAnnouncement(10); $picture->setExtension('gif'); $pictureMapper = new PictureMapper(); $pictureMapper->setId(1); $pictureMapper->updatePicture($picture); $this->assertEquals($picture, $pictureMapper->selectPicture()); }
} 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 !'); } } catch (InvalidArgumentException $e) { print $e->getMessage(); exit; } break; default: Rest::sendResponse(501); break; }