Drawings now generate revisions, not replace

Updated drawing update test to accomodate.
Image deletion system now takes revisions into account.
This commit is contained in:
Dan Brown
2018-05-13 17:41:35 +01:00
parent d5b922aa50
commit 13ad0031d6
8 changed files with 112 additions and 40 deletions

View File

@ -210,7 +210,7 @@ class ImageTest extends TestCase
$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();
@ -235,6 +235,15 @@ class ImageTest extends TestCase
'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());