]> BookStack Code Mirror - bookstack/blobdiff - tests/Helpers/EntityProvider.php
Comments: Added HTML filter on load, tinymce elem filtering
[bookstack] / tests / Helpers / EntityProvider.php
index ddc854290b17c5a1384561aaf96ed0ccddefe347..982063421453139c95470d4ac637a45f55f2b63e 100644 (file)
@@ -11,6 +11,7 @@ use BookStack\Entities\Repos\BookRepo;
 use BookStack\Entities\Repos\BookshelfRepo;
 use BookStack\Entities\Repos\ChapterRepo;
 use BookStack\Entities\Repos\PageRepo;
+use BookStack\Entities\Tools\TrashCan;
 use BookStack\Users\Models\User;
 use Illuminate\Database\Eloquent\Builder;
 
@@ -52,6 +53,15 @@ class EntityProvider
         return $this->page(fn(Builder $query) => $query->where('chapter_id', '=', 0));
     }
 
+    public function templatePage(): Page
+    {
+        $page = $this->page();
+        $page->template = true;
+        $page->save();
+
+        return $page;
+    }
+
     /**
      * Get an un-fetched chapter from the system.
      */
@@ -197,6 +207,16 @@ class EntityProvider
         return $draftPage;
     }
 
+    /**
+     * Fully destroy the given entity from the system, bypassing the recycle bin
+     * stage. Still runs through main app deletion logic.
+     */
+    public function destroy(Entity $entity)
+    {
+        $trash = app()->make(TrashCan::class);
+        $trash->destroyEntity($entity);
+    }
+
     /**
      * @param Entity|Entity[] $entities
      */