tests; $dbName = $group['database']; if ($dbName === '' || !str_contains(strtolower($dbName), 'test')) { throw new \RuntimeException("Refusing to reset non-test database: {$dbName}"); } $serverConn = Database::connect([ 'hostname' => $group['hostname'], 'username' => $group['username'], 'password' => $group['password'], 'DBDriver' => $group['DBDriver'], 'database' => null, 'charset' => $group['charset'] ?? 'utf8mb4', 'DBCollat' => $group['DBCollat'] ?? 'utf8mb4_general_ci', ], false); $serverConn->query("DROP DATABASE IF EXISTS `{$dbName}`"); $serverConn->query("CREATE DATABASE IF NOT EXISTS `{$dbName}`"); } }