- $chapter = Chapter::visible()->first();
- $resp = $this->deleteJson($this->baseEndpoint . "/{$chapter->id}");
-
- $resp->assertStatus(204);
- $this->assertActivityExists('chapter_delete');
- }
-
- public function test_export_html_endpoint()
- {
- $this->actingAsApiEditor();
- $chapter = Chapter::visible()->first();
-
- $resp = $this->get($this->baseEndpoint . "/{$chapter->id}/export/html");
- $resp->assertStatus(200);
- $resp->assertSee($chapter->name);
- $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.html"');
- }
-
- public function test_export_plain_text_endpoint()
- {
- $this->actingAsApiEditor();
- $chapter = Chapter::visible()->first();
-
- $resp = $this->get($this->baseEndpoint . "/{$chapter->id}/export/plaintext");
- $resp->assertStatus(200);
- $resp->assertSee($chapter->name);
- $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.txt"');
- }
+ $chapter = $this->entities->chapterHasPages();
+ $page = $chapter->pages()->first();
+ $newBook = Book::query()->where('id', '!=', $chapter->book_id)->first();