]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Update search.js
[bookstack] / tests / TestCase.php
index f3f36ca1cc75daa3211c82d0ee5eec2628891b33..b008080d9c3ed92cad3976e6c554628facbb48a3 100644 (file)
@@ -76,4 +76,16 @@ abstract class TestCase extends BaseTestCase
     public function newChapter($input = ['name' => 'test chapter', 'description' => 'My new test chapter'], Book $book) {
         return $this->app[EntityRepo::class]->createFromInput('chapter', $input, $book);
     }
+
+    /**
+     * Create and return a new test page
+     * @param array $input
+     * @return Chapter
+     */
+    public function newPage($input = ['name' => 'test page', 'html' => 'My new test page']) {
+        $book = Book::first();
+        $entityRepo = $this->app[EntityRepo::class];
+        $draftPage = $entityRepo->getDraftPage($book);
+        return $entityRepo->publishPageDraft($draftPage, $input);
+    }
 }
\ No newline at end of file