mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-03-28 18:25:16 +08:00
parent
18ee80a743
commit
96819b7bd9
@ -177,6 +177,7 @@ class ImageRepo
|
|||||||
|
|
||||||
$image->refresh();
|
$image->refresh();
|
||||||
$image->updated_by = user()->id;
|
$image->updated_by = user()->id;
|
||||||
|
$image->touch();
|
||||||
$image->save();
|
$image->save();
|
||||||
$this->imageService->replaceExistingFromUpload($image->path, $image->type, $file);
|
$this->imageService->replaceExistingFromUpload($image->path, $image->type, $file);
|
||||||
$this->loadThumbs($image, true);
|
$this->loadThumbs($image, true);
|
||||||
|
@ -104,11 +104,18 @@ class ImageTest extends TestCase
|
|||||||
$this->assertFileEquals($this->files->testFilePath('test-image.png'), public_path($relPath));
|
$this->assertFileEquals($this->files->testFilePath('test-image.png'), public_path($relPath));
|
||||||
|
|
||||||
$imageId = $imgDetails['response']->id;
|
$imageId = $imgDetails['response']->id;
|
||||||
|
$image = Image::findOrFail($imageId);
|
||||||
|
$image->updated_at = now()->subMonth();
|
||||||
|
$image->save();
|
||||||
|
|
||||||
$this->call('PUT', "/images/{$imageId}/file", [], [], ['file' => $newUpload])
|
$this->call('PUT', "/images/{$imageId}/file", [], [], ['file' => $newUpload])
|
||||||
->assertOk();
|
->assertOk();
|
||||||
|
|
||||||
$this->assertFileEquals($this->files->testFilePath('compressed.png'), public_path($relPath));
|
$this->assertFileEquals($this->files->testFilePath('compressed.png'), public_path($relPath));
|
||||||
|
|
||||||
|
$image->refresh();
|
||||||
|
$this->assertTrue($image->updated_at->gt(now()->subMinute()));
|
||||||
|
|
||||||
$this->files->deleteAtRelativePath($relPath);
|
$this->files->deleteAtRelativePath($relPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user