$this->withHtml($searchFailRequest)->assertElementNotExists('div');
}
+ public function test_image_gallery_lists_for_draft_page()
+ {
+ $this->actingAs($this->users->editor());
+ $draft = $this->entities->newDraftPage();
+ $this->files->uploadGalleryImageToPage($this, $draft);
+ $image = Image::query()->where('uploaded_to', '=', $draft->id)->firstOrFail();
+
+ $resp = $this->get("/images/gallery?page=1&uploaded_to={$draft->id}");
+ $resp->assertSee($image->getThumb(150, 150));
+ }
+
public function test_image_usage()
{
$page = $this->entities->page();
$file = $this->files->imageFromBase64File('bad-php.base64', $fileName);
$upload = $this->withHeader('Content-Type', 'image/jpeg')->call('POST', '/images/gallery', ['uploaded_to' => $page->id], [], ['file' => $file], []);
- $upload->assertStatus(302);
+ $upload->assertStatus(500);
+ $this->assertStringContainsString('The file must have a valid & supported image extension', $upload->json('message'));
$this->assertFalse(file_exists(public_path($relPath)), 'Uploaded php file was uploaded but should have been stopped');
$file = $this->files->imageFromBase64File('bad-phtml.base64', $fileName);
$upload = $this->withHeader('Content-Type', 'image/jpeg')->call('POST', '/images/gallery', ['uploaded_to' => $page->id], [], ['file' => $file], []);
- $upload->assertStatus(302);
+ $upload->assertStatus(500);
+ $this->assertStringContainsString('The file must have a valid & supported image extension', $upload->json('message'));
$this->assertFalse(file_exists(public_path($relPath)), 'Uploaded php file was uploaded but should have been stopped');
}