* Make RootUrlBootstrapper run ONLY in CLI by default (add $rootUrlOverrideInTests), work with resolved UrlGenerator
* Make resolving 'url' return a pre-created generator instance instead of creating it on every app('url') call
* Take care of doubling tenant keys in TenancyUrlGenerator, add regression test for using UrlGenerator and RootUrl bootstrappers together
* Fix code style (php-cs-fixer)
* refactor RootUrlBootstrapper
* add docblock
* clarify docblock
* simplify test: use concrete values instead of overly dynamic code
* Fix bootstrapper order in test, add url('/') assertion
* Use $this->app instead of app()
* Improve TenancyUrlGenerator and RootUrlBootstrapperTest clarity
* Revert attempt to maintain compatibility between the two bootstrappers
* Delete bootstrapper combining test
* Fix code style (php-cs-fixer)
---------
Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
* Declare sensitive parameters as sensitive
... just so that they don't show up in logs
* Remove unnecessary null-coalescing
* Simplify return
* Merge isset() calls
* Inline return
* Use nullsafe operator
* Simplify if-else branches
* Use direct empty string comparison instead of strlen()
* Add missing type
* Change interface as events expect a TenantWithDatabase not just a Tenant
* Narrow typehint
* Remove redundant type casts
* Fix style with php-cs-fixer
* Fix typos
* Revert unwanted if-else simplification
* fix phpstan errors
* narrow type
---------
Co-authored-by: Samuel Štancl <samuel@archte.ch>
* Separate route-level domain identification test from path/request to improve readability WIP
* Get rid of confusing datasets in route-level identifcation tests
* Clean up updated tests
* Simplify early id tests
* Reduce dataset duplication
* Improve test readability, fix false positive, polish details
* Separate early ID test from defaulting test (WIP)
* Finish improving and correcting the early identification/default route mode tests
* Make flag/default mode usage more clear by improving the docblock in DealsWithRouteContexts
* Fix PHPUnit deprecation warnings
* code review
* code review
---------
Co-authored-by: Samuel Štancl <samuel@archte.ch>
This PR adds support for named in-memory SQLite databases, making it feasible to use in-memory SQLite for tenant databases in tests.
The usage is simply creating a tenant with 'tenancy_db_name' => ':memory:' and the bootstrapper will automatically update the tenant with a database name derived from its tenant key.
There are static property hooks for keeping these DBs alive (at least one connection needs to be open, they don't have process lifetime and are essentially "refcounted") and closing them when the database is deleted. This gives the user control over the lifetimes of these databases.
This makes it possible to have Domain records in both `foo` and
`foo.{centralDomain}` format when using the combined domain/subdomain
identification middleware, or the origin header id mw which extends it.
This commit also refactors some related logic.
* Add option to update attributes of pending tenants while pulling them
* Fix failing toEqualCanonicalizing tests
* Fix code style (php-cs-fixer)
* fix code errors
* lock phpcsfixer to 3.62.0 due to a bug in 3.63.1
---------
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
* route cloning: Trim '/' from original route prefixes
* Add test for the trimming of route prefixes
* Revert "Add test for the trimming of route prefixes"
This reverts commit 568ae17d2bf8d5542a0e46840f7604c6a0df236d.
* Add test for the trimming of route prefixes
* Delete extra comments [ci skip]
* Fix regression test [ci skip]
* trigger CI
* Add routes with trailing slashes to the cloned route prefixing test
* Test nested '/' route cloning
* Update cloned route creation as suggested
* fix terminology
* add comment to test
---------
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>