๐ŸงชTesting your implementation

Laravel AWS Webhooks uses Laravel AWS SNS Events under the hood, so it exposes its GeneratesSnsMessages trait to generate valid SNS messages to send via HTTP POST on your defined endpoints.

Generating SNS messages to test your implementation during unit/feature tests is explained in the Testing your implementation section for the SNS Events package.

Laravel AWS Webhooks also ships with an extended SNS trait that helps you generate messages for Cloudwatch OR SES in an easier manner:

use RenokiCo\AwsWebhooks\Concerns\GeneratesSnsWebhookMessages;

class MyTest extends TestCase
    use GeneratesSnsWebhookMessages;

    public function testing_cloudwatch_alarm_state()
        // Transitioning from ALARM to OK
        $payload = $this->getCloudwatchMessage('ALARM', 'OK');
        $this->sendSnsMessage(route('cloudwatch'), $payload)

        Event::assertDispatched(AlarmIsOk::class, ...);

Last updated