Skip to content

Commit

Permalink
Add deserialized object assertion to webhook test (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe authored Jan 16, 2024
1 parent 65b9e1f commit 53d5dd0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/Stripe/WebhookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ final class WebhookTest extends \Stripe\TestCase

const EVENT_PAYLOAD = '{
"id": "evt_test_webhook",
"object": "event"
"object": "event",
"data": { "object": { "id": "rdr_123", "object": "terminal.reader" } }
}';
const SECRET = 'whsec_test_secret';

Expand All @@ -37,6 +38,7 @@ public function testValidJsonAndHeader()
$sigHeader = $this->generateHeader();
$event = Webhook::constructEvent(self::EVENT_PAYLOAD, $sigHeader, self::SECRET);
static::assertSame('evt_test_webhook', $event->id);
static::assertInstanceOf(\Stripe\Terminal\Reader::class, $event->data->__get('object'));
}

public function testInvalidJson()
Expand Down

0 comments on commit 53d5dd0

Please sign in to comment.