- ->call('POST', '/images/gallery/upload', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);
+ ->call('POST', '/images/gallery', ['uploaded_to' => $uploadedTo], [], ['file' => $file], []);
+ }
+
+ /**
+ * Upload a new gallery image.
+ * Returns the image name.
+ * Can provide a page to relate the image to.
+ *
+ * @param Page|null $page
+ *
+ * @return array{name: string, path: string, page: Page, response: stdClass}
+ */
+ protected function uploadGalleryImage(Page $page = null, ?string $testDataFileName = null)
+ {
+ if ($page === null) {
+ $page = $this->entities->page();
+ }
+
+ $imageName = $testDataFileName ?? 'first-image.png';
+ $relPath = $this->getTestImagePath('gallery', $imageName);
+ $this->deleteImage($relPath);
+
+ $upload = $this->uploadImage($imageName, $page->id, 'image/png', $testDataFileName);
+ $upload->assertStatus(200);
+
+ return [
+ 'name' => $imageName,
+ 'path' => $relPath,
+ 'page' => $page,
+ 'response' => json_decode($upload->getContent()),
+ ];