diff --git a/tests/RequestOriginIdentificationTest.php b/tests/RequestOriginIdentificationTest.php new file mode 100644 index 00000000..f83ea21f --- /dev/null +++ b/tests/RequestOriginIdentificationTest.php @@ -0,0 +1,43 @@ + [ + 'localhost', + ], + ]); + + Route::middleware(InitializeTenancyByRequestOrigin::class)->get('/test', function () { + return 'Tenant id: ' . tenant('id'); + }); + } + + /** @test */ + public function origin_identification_works() + { + $tenant = Tenant::create(); + $tenant->domains()->create([ + 'domain' => 'localhost' + ]); + + $this + ->withoutExceptionHandling() + ->get('test', [ + 'Origin' => 'http://localhost', + ]) + ->assertSee($tenant->id); + } +}