7 class ApiDocsTest extends TestCase
11 protected string $endpoint = '/api/docs';
13 public function test_api_endpoint_redirects_to_docs()
15 $resp = $this->actingAsApiEditor()->get('/api');
16 $resp->assertRedirect('api/docs');
19 public function test_docs_page_returns_view_with_docs_content()
21 $resp = $this->actingAsApiEditor()->get($this->endpoint);
22 $resp->assertStatus(200);
23 $resp->assertSee(url('/api/docs.json'));
24 $resp->assertSee('Show a JSON view of the API docs data.');
25 $resp->assertHeader('Content-Type', 'text/html; charset=UTF-8');
28 public function test_docs_json_endpoint_returns_json()
30 $resp = $this->actingAsApiEditor()->get($this->endpoint . '.json');
31 $resp->assertStatus(200);
32 $resp->assertHeader('Content-Type', 'application/json');
35 'name' => 'docs-display',