Skip to content

Commit

Permalink
replace expectException with try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
vermakhushboo committed Oct 3, 2024
1 parent 705ce9e commit 9c14ebe
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/Pay/Adapter/StripeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,13 @@ public function testDeletePaymentMethod(array $data): void
$deleted = $this->stripe->deletePaymentMethod($data['paymentMethodId']);
$this->assertTrue($deleted);

$this->expectException('Exception');
$this->expectExceptionCode(404);
$this->stripe->getPaymentMethod($customerId, $data['paymentMethodId']);
try {
$this->stripe->getPaymentMethod($customerId, $data['paymentMethodId']);
$this->fail('Expected exception was not thrown');
} catch (Exception $e) {
$this->assertInstanceOf(Exception::class, $e);
$this->assertEquals(404, $e->getCode());
}
}

/**
Expand Down

0 comments on commit 9c14ebe

Please sign in to comment.