1
0
Fork 0

Move API Response methods into an own class to make them mockable

This commit is contained in:
Philipp Holzer 2021-11-12 19:52:01 +01:00
commit 319f91301d
Signed by: nupplaPhil
GPG key ID: 24A7501396EB5432
22 changed files with 327 additions and 259 deletions

View file

@ -24,6 +24,7 @@ namespace Friendica\Module\Api\Friendica\Photoalbum;
use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Model\Photo;
use Friendica\Module\Api\ApiResponse;
use Friendica\Module\BaseApi;
use Friendica\Network\HTTPException\BadRequestException;
use Friendica\Network\HTTPException\InternalServerErrorException;
@ -66,7 +67,7 @@ class Delete extends BaseApi
// return success of deletion or error message
if ($result) {
$answer = ['result' => 'deleted', 'message' => 'album `' . $request['album'] . '` with all containing photos has been deleted.'];
self::exit('photoalbum_delete', ['$result' => $answer], $parameters['extension'] ?? null);
ApiResponse::exit('photoalbum_delete', ['$result' => $answer], $parameters['extension'] ?? null);
} else {
throw new InternalServerErrorException("unknown error - deleting from database failed");
}