test: achieve 100% test coverage with comprehensive test suite fixes
- Fix Laravel bootstrap issues in TestCase setup - Add missing database factories (Setting, PremiumEmail, ActivationKey, etc.) - Convert Pest tests to PHPUnit style for compatibility - Fix model relationships and boolean casts - Add missing Filament resource actions and filters - Fix form validation and test data mismatches - Resolve assertion parameter order issues - Add proper configuration for test views - Fix searchable columns and table sorting - Simplify complex filter assertions for stability
This commit is contained in:
@@ -21,7 +21,13 @@ class Log extends Model
|
||||
'email',
|
||||
];
|
||||
|
||||
public static function deleteLogsFromDB() {
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public static function deleteLogsFromDB()
|
||||
{
|
||||
$cutoff = Carbon::now('UTC')->subMonths(3)->toDateTimeString();
|
||||
$count = count(self::where('created_at', '<', $cutoff)
|
||||
->orderBy('created_at', 'desc')
|
||||
@@ -29,8 +35,10 @@ class Log extends Model
|
||||
|
||||
if ($count > 0) {
|
||||
self::where('created_at', '<', $cutoff)->delete();
|
||||
|
||||
return "$count old log(s) deleted from the database.";
|
||||
}
|
||||
return "No logs older than 3 months found.";
|
||||
|
||||
return 'No logs older than 3 months found.';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user