]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/SearchApiTest.php
System CLI: Updated to 126de5599c state
[bookstack] / tests / Api / SearchApiTest.php
index eb323fdd92a0e7267c68179d2dba235814f7a800..2a186e8d6328c4133b86eeb643d1436f40d5b78b 100644 (file)
@@ -38,33 +38,31 @@ 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();
 
         $resp = $this->actingAsApiAdmin()->getJson($this->baseEndpoint . '?query=superuniquevalue');
         $resp->assertJsonFragment([
             'type' => 'page',
-            'url' => $page->getUrl(),
+            'url'  => $page->getUrl(),
         ]);
     }
 
     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');
         $resp->assertJsonFragment([
-            'type' => 'book',
-            'url' => $book->getUrl(),
+            'type'         => 'book',
+            'url'          => $book->getUrl(),
             'preview_html' => [
-                'name' => 'name with <strong>superuniquevalue</strong> within',
+                'name'    => 'name with <strong>superuniquevalue</strong> within',
                 'content' => 'Description with <strong>superuniquevalue</strong> within',
-            ]
+            ],
         ]);
     }