Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use assertions in callables
  • Loading branch information
freekmurze committed Jun 24, 2019
1 parent 382c076 commit 60bd1b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions tests/IntegrationTest.php
Expand Up @@ -44,11 +44,10 @@ public function it_can_handle_a_valid_request()
$this->assertNull($webhookCall->exception);

Event::assertDispatched('stripe-webhooks::my.type', function ($event, $eventPayload) use ($webhookCall) {
if (! $eventPayload instanceof WebhookCall) {
return false;
}
$this->assertInstanceOf(WebhookCall::class, $eventPayload);
$this->assertEquals($webhookCall->id, $eventPayload->id);

return $eventPayload->id === $webhookCall->id;
return true;
});

$this->assertEquals($webhookCall->id, cache('dummyjob')->id);
Expand Down
7 changes: 3 additions & 4 deletions tests/StripeWebhookCallTest.php
Expand Up @@ -68,11 +68,10 @@ public function it_will_dispatch_events_even_when_no_corresponding_job_is_config
$webhookCall = $this->webhookCall;

Event::assertDispatched("stripe-webhooks::{$webhookCall->payload['type']}", function ($event, $eventPayload) use ($webhookCall) {
if (! $eventPayload instanceof WebhookCall) {
return false;
}
$this->assertInstanceOf(WebhookCall::class, $eventPayload);
$this->assertEquals($webhookCall->id, $eventPayload->id);

return $eventPayload->id === $webhookCall->id;
return true;
});

$this->assertNull(cache('dummyjob'));
Expand Down

0 comments on commit 60bd1b1

Please sign in to comment.