]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ApiListingTest.php
Fix English translations
[bookstack] / tests / Api / ApiListingTest.php
index fa28dfb368b79b4141e275dc7875cb87c1240dff..bb4920cc3667d35d5c52ec3df904515a817cd602 100644 (file)
@@ -1,10 +1,7 @@
-<?php
+<?php namespace Tests\Api;
 
-namespace Tests;
-
-use BookStack\Auth\Permissions\RolePermission;
 use BookStack\Entities\Book;
-use Carbon\Carbon;
+use Tests\TestCase;
 
 class ApiListingTest extends TestCase
 {
@@ -84,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