mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-08-09 10:22:51 +03:00
Moved more tests out of EntityTest
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Entity;
|
||||
|
||||
use BookStack\Entities\Models\Book;
|
||||
use BookStack\Entities\Models\Page;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -49,4 +50,28 @@ class PageEditorTest extends TestCase
|
||||
$this->asAdmin()->get($this->page->getUrl() . '/edit')
|
||||
->assertElementContains('[name="markdown"]', $this->page->html);
|
||||
}
|
||||
|
||||
public function test_empty_markdown_still_saves_without_error()
|
||||
{
|
||||
$this->setSettings(['app-editor' => 'markdown']);
|
||||
/** @var Book $book */
|
||||
$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