1
0
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:
Dan Brown
2021-08-21 18:54:38 +01:00
parent 822fea4303
commit b005acdd6c
2 changed files with 23 additions and 2 deletions

View File

@ -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();