]> BookStack Code Mirror - bookstack/blobdiff - tests/ErrorTest.php
Update PWA manifest orientation to any
[bookstack] / tests / ErrorTest.php
index 6ba01dd88e6ed8dfb094e637f3cbf6ed1ea6cfe1..0d2ef808c48af0cfa1ed608ea2c4c6d23e3eec08 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace Tests;
 
+use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
 use Illuminate\Support\Facades\Log;
 
 class ErrorTest extends TestCase
@@ -45,4 +46,16 @@ class ErrorTest extends TestCase
         $resp->assertStatus(404);
         $resp->assertSeeText('Image Not Found');
     }
+
+    public function test_posts_above_php_limit_shows_friendly_error()
+    {
+        // Fake super large JSON request
+        $resp = $this->asEditor()->call('GET', '/books', [], [], [], [
+            'CONTENT_LENGTH' => '10000000000',
+            'HTTP_ACCEPT' => 'application/json',
+        ]);
+
+        $resp->assertStatus(413);
+        $resp->assertJson(['error' => 'The server cannot receive the provided amount of data. Try again with less data or a smaller file.']);
+    }
 }