add tests

This commit is contained in:
Dennis Eichhorn 2020-02-19 22:24:22 +01:00
parent 2e5ec71f29
commit d6d7bc2f89
2 changed files with 11 additions and 8 deletions

View File

@ -291,7 +291,7 @@ final class ApiController extends Controller
{ {
$old = clone MediaMapper::get((int) $request->getData('id')); $old = clone MediaMapper::get((int) $request->getData('id'));
$new = $this->updateMediaFromRequest($request); $new = $this->updateMediaFromRequest($request);
$this->updateModel($request, $old, $new, MediaMapper::class, 'media'); $this->updateModel($request->getHeader()->getAccount(), $old, $new, MediaMapper::class, 'media');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media successfully updated', $new); $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media successfully updated', $new);
} }

View File

@ -532,13 +532,16 @@ class Media implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'name' => $this->name, 'name' => $this->name,
'description' => $this->description, 'description' => $this->description,
'extension' => $this->extension, 'descriptionRaw' => $this->descriptionRaw,
'virtualpath' => $this->virtualPath, 'extension' => $this->extension,
'size' => $this->size, 'virtualpath' => $this->virtualPath,
'hidden' => $this->hidden, 'size' => $this->size,
'hidden' => $this->hidden,
'path' => $this->path,
'absolute' => $this->isAbsolute,
]; ];
} }