]> BookStack Code Mirror - bookstack/blobdiff - tests/Api/ApiConfigTest.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / tests / Api / ApiConfigTest.php
index 99b063c69bfcb1b146c65729d819dff19dec7c2e..af808a76ca3f545535aa2ea9b3f494f0966fa48e 100644 (file)
@@ -1,11 +1,10 @@
 <?php
 
-namespace Tests;
+namespace Tests\Api;
 
-use BookStack\Auth\Permissions\RolePermission;
-use Carbon\Carbon;
+use Tests\TestCase;
 
-class ApiAuthTest extends TestCase
+class ApiConfigTest extends TestCase
 {
     use TestsApi;
 
@@ -44,4 +43,14 @@ class ApiAuthTest extends TestCase
         $resp->assertJsonCount(2, 'data');
     }
 
-}
\ No newline at end of file
+    public function test_requests_per_min_alters_rate_limit()
+    {
+        $resp = $this->actingAsApiEditor()->get($this->endpoint);
+        $resp->assertHeader('x-ratelimit-limit', 180);
+
+        config()->set(['api.requests_per_minute' => 10]);
+
+        $resp = $this->actingAsApiEditor()->get($this->endpoint);
+        $resp->assertHeader('x-ratelimit-limit', 10);
+    }
+}