]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/BookDefaultTemplateTest.php
added template to chapter API controller
[bookstack] / tests / Entity / BookDefaultTemplateTest.php
index f23ba4a8e2d1c39f46cfb9b23056b970cda1b2ad..d4cd5b2c3a90f4a6e0d9490e78058cb0e4dd60c7 100644 (file)
@@ -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();