spatie / laravel-multitenancy

Make your Laravel app usable by multiple tenants
https://spatie.be/docs/laravel-multitenancy
MIT License
1.11k stars 153 forks source link

Fix determineCurrentTenant Execution in Unit Tests #468

Closed georak closed 1 year ago

georak commented 1 year ago

This PR addresses an issue where the determineCurrentTenant method was not being executed during unit tests, causing the Spatie\Multitenancy\Exceptions\NoCurrentTenant exception to be thrown. This issue prevented proper testing of HTTP requests in a multitenant environment.

The fix ensures that determineCurrentTenant is executed not only when the application is not running in the console but also when it is running unit tests. This allows for complete test coverage of HTTP requests that involve tenant identification.

By implementing this fix, developers can now effectively write and run unit tests that cover tenant identification through HTTP requests, ensuring that their applications are robust and reliable.

image

image