mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-04 17:04:32 +08:00
@ -161,4 +161,27 @@ class PageTest extends TestCase
|
||||
'book_id' => $newBook->id,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_empty_markdown_still_saves_without_error()
|
||||
{
|
||||
$this->setSettings(['app-editor' => 'markdown']);
|
||||
$book = Book::query()->first();
|
||||
|
||||
$this->asEditor()->get($book->getUrl('/create-page'));
|
||||
$draft = Page::query()->where('book_id', '=', $book->id)
|
||||
->where('draft', '=', true)->first();
|
||||
|
||||
$details = [
|
||||
'name' => 'my page',
|
||||
'markdown' => '',
|
||||
];
|
||||
$resp = $this->post($book->getUrl("/draft/{$draft->id}"), $details);
|
||||
$resp->assertRedirect();
|
||||
|
||||
$this->assertDatabaseHas('pages', [
|
||||
'markdown' => $details['markdown'],
|
||||
'id' => $draft->id,
|
||||
'draft' => false
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user