insert([ [ 'id' => 1, 'title' => 'Old', 'message' => 'Old', 'target_group' => 'all', 'delivery_channels' => json_encode(['in_app']), 'priority' => 1, 'status' => 'sent', 'scheduled_at' => now()->subDays(2), 'expires_at' => now()->subDay(), 'school_year' => '2024-2025', 'semester' => 'Spring', ], [ 'id' => 2, 'title' => 'Active', 'message' => 'Active', 'target_group' => 'all', 'delivery_channels' => json_encode(['in_app']), 'priority' => 1, 'status' => 'sent', 'scheduled_at' => now()->subDay(), 'expires_at' => now()->addDay(), 'school_year' => '2024-2025', 'semester' => 'Spring', ], ]); $service = new NotificationCleanupService; $deleted = $service->cleanupExpired(); $this->assertSame(1, $deleted); $this->assertSoftDeleted('notifications', ['id' => 1]); $this->assertDatabaseHas('notifications', ['id' => 2]); } }