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:
parent
36782ebee7
commit
3fb0176878
1 changed files with 4 additions and 3 deletions
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue