Laravel AWS SNS Events
7.x
7.x
  • โšกIntroduction
  • ๐ŸŽ‰Support
  • Getting Started
    • โฌ†๏ธUpgrading from 6.x
    • ๐Ÿš€Installation
    • ๐Ÿ“กConfiguring Events
    • ๐ŸงชTesting your implementation
  • Customization
    • ๐Ÿ“ฆCustom Payload
    • ๐ŸคฟCustom Event Classes
    • ๐Ÿ”—Custom Method Hooks
  • AWS Webhooks
    • โšกIntroduction
    • ๐Ÿš€Installation
    • ๐Ÿ™ŒShowcase
    • ๐Ÿ–ฅ๏ธSupported AWS Services
      • ๐ŸšจCloudWatch Alerts
      • ๐Ÿ“งSimple Email Service (SES)
      • ๐ŸŒ‰EventBridge Events
    • ๐ŸงชTesting your implementation
Powered by GitBook
On this page

Was this helpful?

  1. AWS Webhooks

Testing your implementation

PreviousEventBridge Events

Last updated 3 years ago

Was this helpful?

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 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)
            ->assertSee('OK');

        Event::assertDispatched(AlarmIsOk::class, ...);
    }   
}
๐Ÿงช
Testing your implementation