Skip to content

Testing

Package Tests

Run the package test suite, static analysis, and code formatting with the following Composer commands:

bash
composer test
bash
composer analyse
bash
composer format

Testing Webhooks

Use WebhookPayloadFactory to generate realistic webhook payloads in your tests. This is especially useful when writing feature or integration tests for your webhook listeners.

For full details on setting up and handling webhooks, see the Webhooks page.

php
use Rollogi\LaravelHubspot\Testing\WebhookPayloadFactory;

$payload = WebhookPayloadFactory::contactCreation();
$payload = WebhookPayloadFactory::contactDeletion();
$payload = WebhookPayloadFactory::contactPropertyChange('email', 'new@example.com');
$payload = WebhookPayloadFactory::companyCreation();
$payload = WebhookPayloadFactory::dealCreation();
$payload = WebhookPayloadFactory::dealStageChange('closedwon', 'qualifiedtobuy');
$payload = WebhookPayloadFactory::ticketCreation();

// Override any field
$payload = WebhookPayloadFactory::contactCreation(['objectId' => 12345]);