mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-30 04:23:11 +03:00
Updated pages API to not clear content if not provided
Can now update page details without supplying page content. Added test to cover. Closes #2856
This commit is contained in:
@ -219,6 +219,27 @@ class PagesApiTest extends TestCase
|
||||
$resp->assertStatus(403);
|
||||
}
|
||||
|
||||
public function test_update_endpoint_does_not_wipe_content_if_no_html_or_md_provided()
|
||||
{
|
||||
$this->actingAsApiEditor();
|
||||
$page = Page::visible()->first();
|
||||
$originalContent = $page->html;
|
||||
$details = [
|
||||
'name' => 'My updated API page',
|
||||
'tags' => [
|
||||
[
|
||||
'name' => 'freshtag',
|
||||
'value' => 'freshtagval',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
$this->putJson($this->baseEndpoint . "/{$page->id}", $details);
|
||||
$page->refresh();
|
||||
|
||||
$this->assertEquals($originalContent, $page->html);
|
||||
}
|
||||
|
||||
public function test_delete_endpoint()
|
||||
{
|
||||
$this->actingAsApiEditor();
|
||||
|
Reference in New Issue
Block a user