Skip to content

Commit

Permalink
add test for checkout resource api
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdrakedennis committed Mar 31, 2023
1 parent 88896cb commit c98c871
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/CheckoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,34 @@
expect($response->successful())->toBeTrue();
expect($response->json())->toHaveKey('price', 12.34);
});


it('successfully creates a checkout request with resource api', function () {
$mockClient = new MockClient([
CreateCheckoutRequest::class => MockResponse::fixture('create.checkout.request'),
]);

$checkout = new TebexCheckout('foo', 'bar');
$checkout->withMockClient($mockClient);

$response = $checkout->checkout()->create(
basket: [
'return_url' => 'http://foo.com',
'complete_url' => 'http://bar.com',
'custom' => [
'baz' => 'buzz',
],
],
items: [
[
'package' => [
'name' => 'foobar',
'price' => 12.34,
],
],
]
);

expect($response->successful())->toBeTrue();
expect($response->json())->toHaveKey('price', 12.34);
});

0 comments on commit c98c871

Please sign in to comment.