mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-11-22 14:10:48 +08:00
Default templates: Fixed syntax for php8.0, added test
Null accessor is akward in php8.0 and throws warnings, so removed. Added test to check template assingment handling on page delete.
This commit is contained in:
parent
2f3806244c
commit
3af07addf6
|
@ -49,7 +49,7 @@
|
|||
@include('form.page-picker', [
|
||||
'name' => 'default_template_id',
|
||||
'placeholder' => trans('entities.books_default_template_select'),
|
||||
'value' => $book?->default_template_id ?? null,
|
||||
'value' => $book->default_template_id ?? null,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -159,6 +159,21 @@ class BookDefaultTemplateTest extends TestCase
|
|||
$this->assertEquals('', $latestPage->markdown);
|
||||
}
|
||||
|
||||
public function test_template_page_delete_removes_book_template_usage()
|
||||
{
|
||||
$templatePage = $this->entities->templatePage();
|
||||
$book = $this->bookUsingDefaultTemplate($templatePage);
|
||||
|
||||
$book->refresh();
|
||||
$this->assertEquals($templatePage->id, $book->default_template_id);
|
||||
|
||||
$this->asEditor()->delete($templatePage->getUrl());
|
||||
$this->asAdmin()->post('/settings/recycle-bin/empty');
|
||||
|
||||
$book->refresh();
|
||||
$this->assertEquals(null, $book->default_template_id);
|
||||
}
|
||||
|
||||
protected function bookUsingDefaultTemplate(Page $page): Book
|
||||
{
|
||||
$book = $this->entities->book();
|
||||
|
|
Loading…
Reference in New Issue
Block a user