]);
}
+ public function test_image_display_thumbnail_generation_does_not_increase_image_size()
+ {
+ $page = Page::first();
+ $admin = $this->getAdmin();
+ $this->actingAs($admin);
+
+ $originalFile = $this->getTestImageFilePath('compressed.png');
+ $originalFileSize = filesize($originalFile);
+ $imgDetails = $this->uploadGalleryImage($page, 'compressed.png');
+ $relPath = $imgDetails['path'];
+
+ $this->assertTrue(file_exists(public_path($relPath)), 'Uploaded image found at path: '. public_path($relPath));
+ $displayImage = $imgDetails['response']->thumbs->display;
+
+ $displayImageRelPath = implode('/', array_slice(explode('/', $displayImage), 3));
+ $displayImagePath = public_path($displayImageRelPath);
+ $displayFileSize = filesize($displayImagePath);
+
+ $this->deleteImage($relPath);
+ $this->deleteImage($displayImageRelPath);
+
+ $this->assertEquals($originalFileSize, $displayFileSize, 'Display thumbnail generation should not increase image size');
+ }
+
public function test_image_edit()
{
$editor = $this->getEditor();
$image = Image::where('type', '=', 'gallery')->first();
$pageRepo = app(PageRepo::class);
- $pageRepo->updatePage($page, $page->book_id, [
+ $pageRepo->update($page, [
'name' => $page->name,
'html' => $page->html . "<img src=\"{$image->url}\">",
'summary' => ''
$this->assertCount(0, $toDelete);
// Save a revision of our page without the image;
- $pageRepo->updatePage($page, $page->book_id, [
+ $pageRepo->update($page, [
'name' => $page->name,
'html' => "<p>Hello</p>",
'summary' => ''