]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/SearchApiTest.php
respective book and chapter structure added.
[bookstack] / tests / Api / SearchApiTest.php
index eb323fdd92a0e7267c68179d2dba235814f7a800..3f2eb395c1101a2dd30b24cbddd6ede241eec612 100644 (file)
@@ -38,8 +38,7 @@ class SearchApiTest extends TestCase
 
     public function test_all_endpoint_returns_entity_url()
     {
-        /** @var Page $page */
-        $page = Page::query()->first();
+        $page = $this->entities->page();
         $page->update(['name' => 'name with superuniquevalue within']);
         $page->indexForSearch();
 
@@ -52,9 +51,8 @@ class SearchApiTest extends TestCase
 
     public function test_all_endpoint_returns_items_with_preview_html()
     {
-        /** @var Book $book */
-        $book = Book::query()->first();
-        $book->update(['name' => 'name with superuniquevalue within', 'description' => 'Description with superuniquevalue within']);
+        $book = $this->entities->book();
+        $book->forceFill(['name' => 'name with superuniquevalue within', 'description' => 'Description with superuniquevalue within'])->save();
         $book->indexForSearch();
 
         $resp = $this->actingAsApiAdmin()->getJson($this->baseEndpoint . '?query=superuniquevalue');
@@ -64,7 +62,7 @@ class SearchApiTest extends TestCase
             'preview_html' => [
                 'name' => 'name with <strong>superuniquevalue</strong> within',
                 'content' => 'Description with <strong>superuniquevalue</strong> within',
-            ]
+            ],
         ]);
     }