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\Enums\Changelog\Reaction;
use App\Enums\PostHog\ChangelogEvent;
use App\Jobs\PostHog\TrackChangelogEntryEvent;
use App\Models\ChangelogEntryView;
use Illuminate\Support\Facades\Bus;
beforeEach(function () {
config(['services.posthog.enabled' => true, 'services.posthog.api_key' => 'phc_test_key']);
Bus::fake();
});
test('creating a view queues the viewed event and changing the reaction queues the reacted event', function () {
$view = ChangelogEntryView::factory()->create();
$view->update(['reaction' => Reaction::Like]);
expect(Bus::dispatched(TrackChangelogEntryEvent::class)->map(fn (TrackChangelogEntryEvent $job): array => [$job->event, $job->reaction])->all())
->toBe([[ChangelogEvent::EntryViewed, null], [ChangelogEvent::EntryReacted, Reaction::Like]]);
});
test('a change to anything but the reaction queues nothing', function () {
$view = ChangelogEntryView::factory()->create();
Bus::fake();
$this->travel(1)->minute();
$view->touch();
Bus::assertNotDispatched(TrackChangelogEntryEvent::class);
});
test('nothing is queued while PostHog is off', function () {
config(['services.posthog.enabled' => false]);
ChangelogEntryView::factory()->create()->update(['reaction' => Reaction::Like]);
Bus::assertNotDispatched(TrackChangelogEntryEvent::class);
});