mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-01-03 23:42:28 +03:00
Image update API: added update image file ability
This commit is contained in:
@@ -295,7 +295,24 @@ class ImageGalleryApiTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_requires_image_delete_permission()
|
||||
public function test_update_existing_image_file()
|
||||
{
|
||||
$this->actingAsApiAdmin();
|
||||
$imagePage = $this->entities->page();
|
||||
$data = $this->files->uploadGalleryImageToPage($this, $imagePage);
|
||||
$image = Image::findOrFail($data['response']->id);
|
||||
|
||||
$this->assertFileEquals($this->files->testFilePath('test-image.png'), public_path($data['path']));
|
||||
|
||||
$resp = $this->call('PUT', $this->baseEndpoint . "/{$image->id}", [], [], [
|
||||
'image' => $this->files->uploadedImage('my-cool-image.png', 'compressed.png'),
|
||||
]);
|
||||
|
||||
$resp->assertStatus(200);
|
||||
$this->assertFileEquals($this->files->testFilePath('compressed.png'), public_path($data['path']));
|
||||
}
|
||||
|
||||
public function test_update_endpoint_requires_image_update_permission()
|
||||
{
|
||||
$user = $this->users->editor();
|
||||
$this->actingAsForApi($user);
|
||||
|
||||
Reference in New Issue
Block a user