mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 19:44:03 +00:00
Cover null parameter skipping
Also cover that in-memory db names aren't validated in databaseExists
This commit is contained in:
parent
46f73c42ad
commit
4bdb877ca4
1 changed files with 14 additions and 0 deletions
|
|
@ -605,6 +605,16 @@ test('database managers validate parameters that cannot be bound', function ($dr
|
|||
|
||||
expect(fn () => $manager->createUser($tenantWithInvalidPassword->database()))
|
||||
->toThrow(InvalidArgumentException::class, $invalidPassword);
|
||||
|
||||
// validateParameter() doesn't throw if a parameter is null
|
||||
$tenantWithNullDbParameters = Tenant::make([
|
||||
'tenancy_db_name' => null,
|
||||
'tenancy_db_username' => null,
|
||||
'tenancy_db_password' => null,
|
||||
]);
|
||||
|
||||
expect(fn () => $manager->createUser($tenantWithNullDbParameters->database()))
|
||||
->not()->toThrow(InvalidArgumentException::class);
|
||||
}
|
||||
|
||||
$validTenant = Tenant::make([
|
||||
|
|
@ -631,6 +641,10 @@ test('sqlite database manager validates the name in databaseExists', function ()
|
|||
|
||||
expect(fn () => $manager->databaseExists('valid-db_name.sqlite'))
|
||||
->not()->toThrow(InvalidArgumentException::class);
|
||||
|
||||
// In-memory database names aren't validated
|
||||
expect(fn () => $manager->databaseExists('../_tenancy_inmemory_'))
|
||||
->not()->toThrow(InvalidArgumentException::class);
|
||||
});
|
||||
|
||||
// Datasets
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue