From 1554a109093ba2c0983a29163b79e6c1f1a58d35 Mon Sep 17 00:00:00 2001 From: SuperDJ <6484766+SuperDJ@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:46:14 +0200 Subject: [PATCH] Update testing.blade.md --- source/docs/v3/testing.blade.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/docs/v3/testing.blade.md b/source/docs/v3/testing.blade.md index 45f617e..b65d8c6 100644 --- a/source/docs/v3/testing.blade.md +++ b/source/docs/v3/testing.blade.md @@ -79,3 +79,18 @@ class FooTest extends TestCase ``` Or you may want to create a separate TestCase class for tenant tests, for better organization. + +When using `InitializeTenancyBySubdomain` you need disable this middleware while testing. This middleware will cause your tests on tenant routes to return a 404 error. Disabling the middleware can be done in the `TestCase` as well. For example: +```php +public function setUp(): void +{ + parent::setUp(); + + if ($this->tenancy) { + $this->initializeTenancy(); + + $this->withoutMiddleware([ + InitializeTenancyBySubdomain::class, + ]); + } +}