Skip to content

Commit

Permalink
Refusal to store gateway configurations in the "tests" directory. All…
Browse files Browse the repository at this point in the history
… configuration options are now stored in a global configuration file.
  • Loading branch information
arhitov committed Apr 22, 2024
1 parent 412d098 commit 7ec46fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
18 changes: 4 additions & 14 deletions tests/Feature/CreatePaymentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@

class CreatePaymentTest extends FeatureTestCase
{
protected function setUp(): void
{
parent::setUp();

// Append test dummy gateway
$billingConfigSaved = config('billing');
$billingConfigSaved['omnipay_gateway']['gateways']['billing-feature-create-payment-dummy'] = $this->getConfigOmnipayGatewayDummy();
$billingConfigSaved['omnipay_gateway']['gateways']['billing-feature-create-payment-yookassa'] = $this->getConfigOmnipayGatewayYooKassa();
config(['billing' => $billingConfigSaved]);
}

/**
* @return void
Expand All @@ -31,7 +21,7 @@ public function testCreateSimpleByDummy()
100,
'Test payment',
$balanceKey,
gatewayName: 'billing-feature-create-payment-dummy',
gatewayName: 'dummy',
card: $this->getDataValidCard(),
);

Expand Down Expand Up @@ -63,7 +53,7 @@ public function testCreateByDummy()
$payment = $owner->createPayment(
$balanceAmount,
'Test payment',
gatewayName: 'billing-feature-create-payment-dummy',
gatewayName: 'dummy',
card: $card,
);

Expand All @@ -90,13 +80,13 @@ public function testCreateByYooKassa()
$payment = $owner->createPayment(
$balanceAmount,
'Test payment',
gatewayName: 'billing-feature-create-payment-yookassa',
gatewayName: 'yookassa',
);

$this->assertFalse($payment->getResponse()->isSuccessful());
$this->assertTrue($payment->getResponse()->isRedirect());
$this->assertEquals(
$this->getConfigOmnipayGatewayYooKassa()['returnUrl'],
config('billing.omnipay_gateway.gateways.yookassa.returnUrl'),
$payment->getResponse()->getRequest()->getReturnUrl()
);

Expand Down
21 changes: 0 additions & 21 deletions tests/FeatureTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,4 @@ protected function getDataValidCard(string $key = 'omnipay_dummy_success'): arra
// 'shippingPhone' => '(555) 987-6543',
], $list[$key]);
}

protected function getConfigOmnipayGatewayDummy(): array
{
return [
'omnipay_class' => 'Dummy',
'capture' => true,
];
}

protected function getConfigOmnipayGatewayYooKassa(): array
{
return [
'omnipay_class' => 'YooKassa',
'omnipay_initialize' => [
'shop_id' => 54401,
'secret' => 'test_Fh8hUAVVBGUGbjmlzba6TB0iyUbos_lueTHE-axOwM0',
],
'returnUrl' => 'https://www.example.com/pay',
'capture' => true,
];
}
}

0 comments on commit 7ec46fd

Please sign in to comment.