]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ApiListingTest.php
Code cleanup, bug squashing
[bookstack] / tests / Api / ApiListingTest.php
index ac6d61aa142c85d1c4e005d85c2ecb1a7e3be454..c3d9bc10888d51e91bc1a584cadabf6ff27b3642 100644 (file)
@@ -1,6 +1,6 @@
 <?php namespace Tests\Api;
 
-use BookStack\Entities\Book;
+use BookStack\Entities\Models\Book;
 use Tests\TestCase;
 
 class ApiListingTest extends TestCase
@@ -81,4 +81,20 @@ class ApiListingTest extends TestCase
         }
     }
 
+    public function test_total_on_results_shows_correctly()
+    {
+        $this->actingAsApiEditor();
+        $bookCount = Book::query()->count();
+        $resp = $this->get($this->endpoint . '?count=1');
+        $resp->assertJson(['total' => $bookCount ]);
+    }
+
+    public function test_total_on_results_shows_correctly_when_offset_provided()
+    {
+        $this->actingAsApiEditor();
+        $bookCount = Book::query()->count();
+        $resp = $this->get($this->endpoint . '?count=1&offset=1');
+        $resp->assertJson(['total' => $bookCount ]);
+    }
+
 }
\ No newline at end of file