1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-04 05:22:38 +03:00
Files
bookstack/tests/Api/ApiDocsTest.php
Dan Brown 2fde803c76 Deps: Updated PHP package versions
Needed to update some tests due to charset casing change in Symfony 7.4
2025-12-03 13:55:00 +00:00

41 lines
1.1 KiB
PHP

<?php
namespace Tests\Api;
use Tests\TestCase;
class ApiDocsTest extends TestCase
{
use TestsApi;
protected string $endpoint = '/api/docs';
public function test_api_endpoint_redirects_to_docs()
{
$resp = $this->actingAsApiEditor()->get('/api');
$resp->assertRedirect('api/docs');
}
public function test_docs_page_returns_view_with_docs_content()
{
$resp = $this->actingAsApiEditor()->get($this->endpoint);
$resp->assertStatus(200);
$resp->assertSee(url('/api/docs.json'));
$resp->assertSee('Show a JSON view of the API docs data.');
$resp->assertHeader('Content-Type', 'text/html; charset=utf-8');
}
public function test_docs_json_endpoint_returns_json()
{
$resp = $this->actingAsApiEditor()->get($this->endpoint . '.json');
$resp->assertStatus(200);
$resp->assertHeader('Content-Type', 'application/json');
$resp->assertJson([
'docs' => [[
'name' => 'docs-display',
'uri' => 'api/docs',
]],
]);
}
}