}
}
+ public function test_secure_images_included_in_exports()
+ {
+ config()->set('filesystems.default', 'local_secure');
+ $this->asEditor();
+ $galleryFile = $this->getTestImage('my-secure-test-upload');
+ $page = Page::first();
+ $expectedPath = storage_path('uploads/images/gallery/' . Date('Y-m-M') . '/my-secure-test-upload');
+
+ $upload = $this->call('POST', '/images/gallery/upload', ['uploaded_to' => $page->id], [], ['file' => $galleryFile], []);
+ $imageUrl = json_decode($upload->getContent(), true)['url'];
+ $page->html .= "<img src=\"{$imageUrl}\">";
+ $page->save();
+ $upload->assertStatus(200);
+
+ $encodedImageContent = base64_encode(file_get_contents($expectedPath));
+ $export = $this->get($page->getUrl('/export/html'));
+ $this->assertTrue(str_contains($export->getContent(), $encodedImageContent), 'Uploaded image in export content');
+
+ if (file_exists($expectedPath)) {
+ unlink($expectedPath);
+ }
+ }
+
public function test_system_images_remain_public()
{
config()->set('filesystems.default', 'local_secure');
$this->assertTrue($testImageData === $uploadedImageData, "Uploaded image file data does not match our test image as expected");
}
- public function test_drawing_replacing()
+ public function test_drawing_updating()
{
$page = Page::first();
$editor = $this->getEditor();
'updated_by' => $editor->id,
]);
+ // Check a revision has been created
+ $this->assertDatabaseHas('image_revisions', [
+ 'image_id' => $image->id,
+ 'revision' => 2,
+ 'created_by' => $editor->id,
+ ]);
+
+ $image = Image::find($image->id);
+
$this->assertTrue(file_exists(public_path($image->path)), 'Uploaded image not found at path: '. public_path($image->path));
$testImageData = file_get_contents($this->getTestImageFilePath());