-
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add new
TenantNotFoundForRequestEvent
- Loading branch information
1 parent
6f1afb3
commit 6ee0abd
Showing
4 changed files
with
47 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Spatie\Multitenancy\Events; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class TenantNotFoundForRequestEvent | ||
{ | ||
public function __construct( | ||
public Request $request | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Event; | ||
use Spatie\Multitenancy\Events\TenantNotFoundForRequestEvent; | ||
use Spatie\Multitenancy\Multitenancy; | ||
|
||
beforeEach(function () { | ||
$this->multitenancy = new Multitenancy(app()); | ||
}); | ||
|
||
it('will fire a TenantNotFoundForRequestEvent when no tenant was found by request', function () { | ||
Event::fake(); | ||
|
||
Event::assertNotDispatched(TenantNotFoundForRequestEvent::class); | ||
|
||
$this->multitenancy->determineCurrentTenant(); | ||
|
||
Event::assertDispatched(TenantNotFoundForRequestEvent::class); | ||
}); |