3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 11:15:42 +00:00

Updated CanSkipTests to allow sqlite and sqlite_testing

This commit is contained in:
snipe
2026-07-27 01:01:18 +01:00
parent 25d8353ec8
commit 8a42b62188

View File

@ -6,15 +6,30 @@ trait CanSkipTests
{
public function markIncompleteIfMySQL($message = 'Test skipped due to database driver being MySQL.')
{
if (config('database.default') === 'mysql') {
if ($this->currentDatabaseDriver() === 'mysql') {
$this->markTestIncomplete($message);
}
}
public function markIncompleteIfSqlite($message = 'Test skipped due to database driver being sqlite.')
{
if (config('database.default') === 'sqlite') {
if ($this->currentDatabaseDriver() === 'sqlite') {
$this->markTestIncomplete($message);
}
}
/**
* Resolve the driver of the current default database connection.
* The default connection can be named anything (sqlite, sqlite_testing,
* mysql, mysql_ci, etc.), so keying off the connection NAME misses
* anything that isn't the canonical name. Reading the driver via the
* connections config makes the skip helpers work regardless of what
* .env.testing calls the connection.
*/
private function currentDatabaseDriver(): ?string
{
$default = config('database.default');
return config("database.connections.$default.driver");
}
}