mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 17:04:04 +00:00
Add validateFilename()
Use validateFilename instead of validateParameter in SQLiteDatabaseManager. Directories are no longer considered valid SQLite database names.
This commit is contained in:
parent
2bd3a868ec
commit
76c324d758
3 changed files with 37 additions and 18 deletions
|
|
@ -615,15 +615,17 @@ test('database managers validate parameters that cannot be bound', function ($dr
|
|||
}
|
||||
})->with('database_managers');
|
||||
|
||||
test('sqlite database manager validates the name in databaseExists', function () {
|
||||
test('sqlite database manager validates database filenames', function () {
|
||||
$manager = app(SQLiteDatabaseManager::class);
|
||||
|
||||
expect(fn () => $manager->databaseExists("../invalid-db-name.sqlite"))
|
||||
->toThrow(InvalidArgumentException::class);
|
||||
|
||||
// Dots are allowed in database names
|
||||
expect(fn () => $manager->databaseExists('valid-db_name.sqlite'))
|
||||
->not()->toThrow(InvalidArgumentException::class);
|
||||
|
||||
// Directories are not allowed as database names
|
||||
expect(fn () => $manager->databaseExists(".."))
|
||||
->toThrow(InvalidArgumentException::class);
|
||||
|
||||
// In-memory database names aren't validated
|
||||
expect(fn () => $manager->databaseExists('../_tenancy_inmemory_'))
|
||||
->not()->toThrow(InvalidArgumentException::class);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue