mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-31 13:05:47 +08:00
@ -1,6 +1,7 @@
|
||||
<?php namespace Tests;
|
||||
|
||||
|
||||
use BookStack\Chapter;
|
||||
use BookStack\Page;
|
||||
|
||||
class ExportTest extends TestCase
|
||||
@ -75,4 +76,40 @@ class ExportTest extends TestCase
|
||||
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $book->slug . '.html');
|
||||
}
|
||||
|
||||
public function test_chapter_text_export()
|
||||
{
|
||||
$chapter = Chapter::first();
|
||||
$page = $chapter->pages[0];
|
||||
$this->asEditor();
|
||||
|
||||
$resp = $this->get($chapter->getUrl('/export/plaintext'));
|
||||
$resp->assertStatus(200);
|
||||
$resp->assertSee($chapter->name);
|
||||
$resp->assertSee($page->name);
|
||||
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.txt');
|
||||
}
|
||||
|
||||
public function test_chapter_pdf_export()
|
||||
{
|
||||
$chapter = Chapter::first();
|
||||
$this->asEditor();
|
||||
|
||||
$resp = $this->get($chapter->getUrl('/export/pdf'));
|
||||
$resp->assertStatus(200);
|
||||
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.pdf');
|
||||
}
|
||||
|
||||
public function test_chapter_html_export()
|
||||
{
|
||||
$chapter = Chapter::first();
|
||||
$page = $chapter->pages[0];
|
||||
$this->asEditor();
|
||||
|
||||
$resp = $this->get($chapter->getUrl('/export/html'));
|
||||
$resp->assertStatus(200);
|
||||
$resp->assertSee($chapter->name);
|
||||
$resp->assertSee($page->name);
|
||||
$resp->assertHeader('Content-Disposition', 'attachment; filename="' . $chapter->slug . '.html');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user