php-plug-altum/tests/Pusher/ClientTest.php
Snider 25a2903db3 test: add Pest tests for AltumClient, product clients, and AltumManager
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 08:53:09 +00:00

35 lines
1 KiB
PHP

<?php
declare(strict_types=1);
use Core\Plug\Altum\Pusher\Client;
use Illuminate\Support\Facades\Http;
beforeEach(function () {
$this->client = new Client(
baseUrl: 'https://push.test',
adminApiKey: 'admin-key',
userApiKey: 'user-key',
);
Http::fake(['*' => Http::response(['data' => []], 200)]);
});
it('lists subscribers', function () {
$this->client->subscribers();
Http::assertSent(fn ($r) => str_contains($r->url(), '/api/subscribers/'));
});
it('creates a campaign', function () {
$this->client->createCampaign(['title' => 'Test', 'url' => 'https://example.com']);
Http::assertSent(fn ($r) => $r->method() === 'POST' && str_contains($r->url(), '/api/campaigns'));
});
it('lists flows', function () {
$this->client->flows();
Http::assertSent(fn ($r) => str_contains($r->url(), '/api/flows/'));
});
it('creates segments', function () {
$this->client->createSegment(['name' => 'VIP']);
Http::assertSent(fn ($r) => $r->method() === 'POST' && str_contains($r->url(), '/api/segments'));
});