mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-13 18:54:04 +00:00
Update testing.blade.md
This commit is contained in:
parent
6184708cf0
commit
1554a10909
1 changed files with 15 additions and 0 deletions
|
|
@ -79,3 +79,18 @@ class FooTest extends TestCase
|
||||||
```
|
```
|
||||||
|
|
||||||
Or you may want to create a separate TestCase class for tenant tests, for better organization.
|
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,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue