1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-06-20 22:54:05 +00:00

improve mysql charset/collation validation test

This commit is contained in:
Samuel Stancl 2026-06-08 14:54:50 -07:00
parent 36782ebee7
commit 3fb0176878
No known key found for this signature in database
GPG key ID: BA146259A1E16C57

View file

@ -628,11 +628,12 @@ test('database managers validate parameters that cannot be bound', function ($dr
} }
})->with('database_managers'); })->with('database_managers');
test('mysql database manager validates charset and collation correctly', function () { test('mysql database manager validates charset and collation correctly', function (string $param) {
$manager = app(MySQLDatabaseManager::class); $manager = app(MySQLDatabaseManager::class);
$manager->setConnection('mysql'); $manager->setConnection('mysql');
config(['database.connections.mysql.charset' => []]); // using a non-string value (empty array) which is invalid
config(["database.connections.mysql.$param" => []]);
DB::purge('mysql'); DB::purge('mysql');
$tenant = Tenant::make([ $tenant = Tenant::make([
@ -641,7 +642,7 @@ test('mysql database manager validates charset and collation correctly', functio
expect(fn () => $manager->createDatabase($tenant)) expect(fn () => $manager->createDatabase($tenant))
->toThrow(InvalidArgumentException::class, 'Parameter has to be a string.'); ->toThrow(InvalidArgumentException::class, 'Parameter has to be a string.');
}); })->with(['charset', 'collation']);
test('sqlite database manager validates database names correctly', function () { test('sqlite database manager validates database names correctly', function () {
$manager = app(SQLiteDatabaseManager::class); $manager = app(SQLiteDatabaseManager::class);