Skip to content

Commit

Permalink
Update TestPaymentMethodRequestsTrait.php
Browse files Browse the repository at this point in the history
  • Loading branch information
r-kujawa committed May 23, 2023
1 parent 39d646f commit b71f5a0
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions tests/Unit/TestPaymentMethodRequestsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ class TestPaymentMethodRequestsTrait extends GatewayTestCase
/** @test */
public function fetch_payment_method_request_auto_configures_payment_gateway()
{
$wallet = $this->createWallet();

$paymentMethod = PaymentMethod::factory()->create([
'wallet_id' => $wallet->id,
]);
$paymentMethod = $this->createPaymentMethod();

$response = $paymentMethod->fetch();

Expand All @@ -28,11 +24,7 @@ public function fetch_payment_method_request_auto_configures_payment_gateway()
/** @test */
public function patch_payment_method_request_auto_configures_payment_gateway()
{
$wallet = $this->createWallet();

$paymentMethod = PaymentMethod::factory()->create([
'wallet_id' => $wallet->id,
]);
$paymentMethod = $this->createPaymentMethod();

$response = $paymentMethod->patch([]);

Expand All @@ -43,24 +35,24 @@ public function patch_payment_method_request_auto_configures_payment_gateway()
/** @test */
public function disable_payment_method_request_auto_configures_payment_gateway()
{
$wallet = $this->createWallet();

$paymentMethod = PaymentMethod::factory()->create([
'wallet_id' => $wallet->id,
]);
$paymentMethod = $this->createPaymentMethod();

$response = $paymentMethod->disable();

$this->assertModelMatchesResponse($paymentMethod, $response);
$this->assertEquals('deletePaymentMethod', $response->data['requestMethod']);
}

private function createWallet()
private function createPaymentMethod()
{
return Wallet::factory()->create([
$wallet = Wallet::factory()->create([
'provider_id' => $this->provider,
'merchant_id' => $this->merchant,
]);

return PaymentMethod::factory()->create([
'wallet_id' => $wallet->id,
]);
}

/**
Expand Down

0 comments on commit b71f5a0

Please sign in to comment.