]> BookStack Code Mirror - bookstack/blob - tests/Api/ApiDocsTest.php
Merge branch 'conflict_warnings' of https://github.com/MatthieuParis/BookStack into...
[bookstack] / tests / Api / ApiDocsTest.php
1 <?php
2
3 namespace Tests\Api;
4
5 use Tests\TestCase;
6
7 class ApiDocsTest extends TestCase
8 {
9     use TestsApi;
10
11     protected $endpoint = '/api/docs';
12
13     public function test_docs_page_returns_view_with_docs_content()
14     {
15         $resp = $this->actingAsApiEditor()->get($this->endpoint);
16         $resp->assertStatus(200);
17         $resp->assertSee(url('/api/docs.json'));
18         $resp->assertSee('Show a JSON view of the API docs data.');
19         $resp->assertHeader('Content-Type', 'text/html; charset=UTF-8');
20     }
21
22     public function test_docs_json_endpoint_returns_json()
23     {
24         $resp = $this->actingAsApiEditor()->get($this->endpoint . '.json');
25         $resp->assertStatus(200);
26         $resp->assertHeader('Content-Type', 'application/json');
27         $resp->assertJson([
28             'docs' => [[
29                 'name' => 'docs-display',
30                 'uri'  => 'api/docs',
31             ]],
32         ]);
33     }
34 }