You are here

function Braintree_WebhookNotificationTest::testSampleNotificationReturnsAParsableNotification in Commerce Braintree 7

File

braintree_php/tests/unit/WebhookNotificationTest.php, line 12

Class

Braintree_WebhookNotificationTest

Code

function testSampleNotificationReturnsAParsableNotification() {
  $sampleNotification = Braintree_WebhookTesting::sampleNotification(Braintree_WebhookNotification::SUBSCRIPTION_WENT_PAST_DUE, 'my_id');
  $webhookNotification = Braintree_WebhookNotification::parse($sampleNotification['signature'], $sampleNotification['payload']);
  $this
    ->assertEquals(Braintree_WebhookNotification::SUBSCRIPTION_WENT_PAST_DUE, $webhookNotification->kind);
  $this
    ->assertNotNull($webhookNotification->timestamp);
  $this
    ->assertEquals("my_id", $webhookNotification->subscription->id);
}