Skip to main content

Testing your integration

Every delivery is a queued job, so Bus::fake() asserts the fan-out without a network call:

use Illuminate\Support\Facades\Bus;
use Pushery\Webhooks\Server\Jobs\CallWebhookJob;
use Pushery\Webhooks\WebhookEvent;

Bus::fake();

WebhookEvent::dispatch('invoice.paid', ['invoice_id' => 'in_123'], tenant: $team);

Bus::assertDispatched(CallWebhookJob::class);

Use ->dispatchSync() on a PendingWebhook when you want the request to actually go out (against a fake HTTP server, say), and drive the inbound side by posting a request signed with Pushery\Webhooks\Core\Signing\StandardWebhooksScheme — the same class the sender uses, so a first-party round trip is testable end to end.

Working on the package itself

Its own suite runs against a real PostgreSQL 18 database — deliberately stricter than the PostgreSQL 13+ the package supports at runtime, so that a green local run proves what a green CI run proves. The suite checks its own floor and fails rather than skipping if the server is older. There is no SQLite fallback: createdb webhooks_for_laravel_test, then point DB_HOST / DB_PORT / DB_DATABASE / DB_USERNAME / DB_PASSWORD at it if it is not the default postgres user on the default port.

The cross-engine parity suites additionally drive a real MySQL 8.4 and a MariaDB server (the MariaDB one proves the guard rejects it), so those run locally. See CONTRIBUTING.md.