1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Merge branch 'fix-api-404' into development

This commit is contained in:
Dan Brown
2023-06-15 17:08:51 +01:00
4 changed files with 60 additions and 23 deletions

View File

@@ -159,6 +159,27 @@ class PagesApiTest extends TestCase
$this->assertStringContainsString('testing', $html);
}
public function test_read_endpoint_returns_not_found()
{
$this->actingAsApiEditor();
// get an id that is not used
$id = Page::orderBy('id', 'desc')->first()->id + 1;
$this->assertNull(Page::find($id));
$resp = $this->getJson($this->baseEndpoint . "/$id");
$resp->assertNotFound();
$this->assertNull($resp->json('id'));
$resp->assertJsonIsObject('error');
$resp->assertJsonStructure([
'error' => [
'code',
'message',
],
]);
$this->assertSame(404, $resp->json('error')['code']);
}
public function test_update_endpoint()
{
$this->actingAsApiEditor();