Skip to content

Commit

Permalink
style: fix code styles
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Dec 24, 2024
1 parent 3fc6b8b commit a885e33
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
31 changes: 16 additions & 15 deletions tests/Unit/Gateways/GarantiPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/**
* @covers \Mews\Pos\Gateways\GarantiPos
* @covers \Mews\Pos\Gateways\AbstractGateway
* @covers \Mews\Pos\Gateways\AbstractGateway
*/
class GarantiPosTest extends TestCase
{
Expand Down Expand Up @@ -70,11 +70,11 @@ protected function setUp(): void
parent::setUp();

$this->config = [
'name' => 'Garanti',
'class' => GarantiPos::class,
'gateway_endpoints' => [
'payment_api' => 'https://sanalposprovtest.garantibbva.com.tr/VPServlet',
'gateway_3d' => 'https://sanalposprovtest.garantibbva.com.tr/servlet/gt3dengine',
'name' => 'Garanti',
'class' => GarantiPos::class,
'gateway_endpoints' => [
'payment_api' => 'https://sanalposprovtest.garantibbva.com.tr/VPServlet',
'gateway_3d' => 'https://sanalposprovtest.garantibbva.com.tr/servlet/gt3dengine',
],
];

Expand Down Expand Up @@ -144,7 +144,8 @@ public function testInit(): void
*/
public function testGet3DFormData(
bool $isWithCard
): void {
): void
{
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$order = ['id' => '124'];
Expand Down Expand Up @@ -265,7 +266,7 @@ public function testMake3DPayment(

public function testMake3DPaymentHashMismatchException(): void
{
$data = GarantiPosResponseDataMapperTest::threeDPaymentDataProvider()['paymentFail1']['threeDResponseData'];
$data = GarantiPosResponseDataMapperTest::threeDPaymentDataProvider()['paymentFail1']['threeDResponseData'];
$request = Request::create('', 'POST', $data);

$this->cryptMock->expects(self::once())
Expand Down Expand Up @@ -309,9 +310,9 @@ public function testMake3DPayPayment(): void
->method('check3DHash');

$responseData = ['$responseData'];
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->responseMapperMock->expects(self::once())
->method('map3DPayResponseData')
Expand Down Expand Up @@ -569,8 +570,8 @@ public function testOrderHistoryRequest(array $order, string $apiUrl): void
*/
public function testCustomQueryRequest(array $requestData, ?string $apiUrl, string $expectedApiUrl): void
{
$account = $this->pos->getAccount();
$txType = PosInterface::TX_TYPE_CUSTOM_QUERY;
$account = $this->pos->getAccount();
$txType = PosInterface::TX_TYPE_CUSTOM_QUERY;

$updatedRequestData = $requestData + [
'abc' => 'def',
Expand Down Expand Up @@ -617,7 +618,7 @@ public static function customQueryRequestDataProvider(): array
public static function make3DPaymentDataProvider(): array
{
return [
'3d_auth_fail_1' => [
'3d_auth_fail_1' => [
'order' => GarantiPosResponseDataMapperTest::threeDPaymentDataProvider()['3d_auth_fail_1']['order'],
'txType' => GarantiPosResponseDataMapperTest::threeDPaymentDataProvider()['3d_auth_fail_1']['txType'],
'request' => Request::create(
Expand Down Expand Up @@ -816,7 +817,7 @@ private function configureClientResponse(
}
)))
->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData['test-update-request-data-with-event'] = true;
$updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);

Expand Down
30 changes: 16 additions & 14 deletions tests/Unit/Gateways/InterPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ protected function setUp(): void
parent::setUp();

$this->config = [
'name' => 'DenizBank-InterPos',
'class' => InterPos::class,
'gateway_endpoints' => [
'name' => 'DenizBank-InterPos',
'class' => InterPos::class,
'gateway_endpoints' => [
'payment_api' => 'https://test.inter-vpos.com.tr/mpi/Default.aspx',
'gateway_3d' => 'https://test.inter-vpos.com.tr/mpi/Default.aspx',
'gateway_3d_host' => 'https://test.inter-vpos.com.tr/mpi/3DHost.aspx',
Expand Down Expand Up @@ -153,7 +153,8 @@ public function testInit(): void
*/
public function testGet3DFormData(
bool $isWithCard
): void {
): void
{
$card = $isWithCard ? $this->card : null;
$paymentModel = $isWithCard ? PosInterface::MODEL_3D_SECURE : PosInterface::MODEL_3D_HOST;
$gatewayUrl = $isWithCard ? 'https://test.inter-vpos.com.tr/mpi/Default.aspx' : 'https://test.inter-vpos.com.tr/mpi/3DHost.aspx';
Expand Down Expand Up @@ -208,7 +209,8 @@ public function testMake3DPayment(
bool $checkHash,
bool $is3DSuccess,
bool $isSuccess
): void {
): void
{
if ($checkHash) {
$this->cryptMock->expects(self::once())
->method('check3DHash')
Expand Down Expand Up @@ -308,9 +310,9 @@ public function testMake3DPayPayment(): void
->method('check3DHash');

$responseData = ['$responseData'];
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->responseMapperMock->expects(self::once())
->method('map3DPayResponseData')
Expand All @@ -335,9 +337,9 @@ public function testMake3DHostPayment(): void
->method('check3DHash');

$responseData = ['$responseData'];
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;
$request = Request::create('', 'POST', $responseData);
$order = ['id' => '123'];
$txType = PosInterface::TX_TYPE_PAY_AUTH;

$this->responseMapperMock->expects(self::once())
->method('map3DHostResponseData')
Expand Down Expand Up @@ -541,8 +543,8 @@ public function testRefundRequest(array $order, string $apiUrl): void
*/
public function testCustomQueryRequest(array $requestData, ?string $apiUrl, string $expectedApiUrl): void
{
$account = $this->pos->getAccount();
$txType = PosInterface::TX_TYPE_CUSTOM_QUERY;
$account = $this->pos->getAccount();
$txType = PosInterface::TX_TYPE_CUSTOM_QUERY;

$updatedRequestData = $requestData + [
'abc' => 'def',
Expand Down Expand Up @@ -758,7 +760,7 @@ private function configureClientResponse(
}
)))
->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData['test-update-request-data-with-event'] = true;
$updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);

Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/Gateways/KuveytPosTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Symfony\Component\HttpFoundation\Request;

/**
* @covers \Mews\Pos\Gateways\KuveytPos
* @covers \Mews\Pos\Gateways\KuveytPos
* @covers \Mews\Pos\Gateways\AbstractGateway
*/
class KuveytPosTest extends TestCase
Expand Down Expand Up @@ -284,7 +284,7 @@ public function testMake3DPayment(
$create3DPaymentRequestData = [
'create3DPaymentRequestData',
];
$encodedRequestData = 'request-body';
$encodedRequestData = 'request-body';


if ($is3DSuccess) {
Expand Down Expand Up @@ -318,8 +318,8 @@ public function testMake3DPayment(
&& $paymentModel === $dispatchedEvent->getPaymentModel();
}
)))
->willReturnCallback(function() use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData['test-update-request-data-with-event'] = true;
$updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);

Expand Down Expand Up @@ -679,7 +679,7 @@ private function configureClientResponse(
}
)))
->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData['test-update-request-data-with-event'] = true;
$updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Gateways/VakifKatilimTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ private function configureClientResponse(
}
)))
->willReturnCallback(function () use (&$updatedRequestDataPreparedEvent): ?\Mews\Pos\Event\RequestDataPreparedEvent {
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData = $updatedRequestDataPreparedEvent->getRequestData();
$updatedRequestData['test-update-request-data-with-event'] = true;
$updatedRequestDataPreparedEvent->setRequestData($updatedRequestData);

Expand Down

0 comments on commit a885e33

Please sign in to comment.