Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
<?php
declare(strict_types=1);
use App\Models\Webhook;
use App\Models\WebhookLog;
test('deletes webhook logs older than 7 days', function () {
$webhook = Webhook::factory()->create();
$old = WebhookLog::factory()->create([
'webhook_id' => $webhook->id,
'created_at' => now()->subDays(8),
]);
$recent = WebhookLog::factory()->create([
'webhook_id' => $webhook->id,
'created_at' => now()->subDays(3),
]);
$this->artisan('app:prune-webhook-logs')
->assertSuccessful();
expect(WebhookLog::find($old->id))->toBeNull();
expect(WebhookLog::find($recent->id))->not->toBeNull();
});
test('keeps logs exactly 7 days old', function () {
$webhook = Webhook::factory()->create();
$borderline = WebhookLog::factory()->create([
'webhook_id' => $webhook->id,
'created_at' => now()->subDays(7),
]);
$this->artisan('app:prune-webhook-logs')
->assertSuccessful();
expect(WebhookLog::find($borderline->id))->not->toBeNull();
});
test('handles empty table gracefully', function () {
$this->artisan('app:prune-webhook-logs')
->assertSuccessful();
expect(WebhookLog::count())->toBe(0);
});