X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/60030a774d8641a1eabc5ce44274bc3b1f8eb25e..refs/pull/3406/head:/tests/Uploads/UsesImages.php diff --git a/tests/Uploads/UsesImages.php b/tests/Uploads/UsesImages.php index a2026d968..b55572248 100644 --- a/tests/Uploads/UsesImages.php +++ b/tests/Uploads/UsesImages.php @@ -1,7 +1,10 @@ -getTestImage($name, $testDataFileName); + return $this->withHeader('Content-Type', $contentType) ->call('POST', '/images/gallery', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []); } @@ -75,8 +83,10 @@ trait UsesImages * Upload a new gallery image. * Returns the image name. * Can provide a page to relate the image to. + * * @param Page|null $page - * @return array + * + * @return array{name: string, path: string, page: Page, response: stdClass} */ protected function uploadGalleryImage(Page $page = null, ?string $testDataFileName = null) { @@ -90,24 +100,23 @@ trait UsesImages $upload = $this->uploadImage($imageName, $page->id, 'image/png', $testDataFileName); $upload->assertStatus(200); + return [ - 'name' => $imageName, - 'path' => $relPath, - 'page' => $page, + 'name' => $imageName, + 'path' => $relPath, + 'page' => $page, 'response' => json_decode($upload->getContent()), ]; } /** * Delete an uploaded image. - * @param $relPath */ - protected function deleteImage($relPath) + protected function deleteImage(string $relPath) { $path = public_path($relPath); if (file_exists($path)) { unlink($path); } } - -} \ No newline at end of file +}