Skip to content

Commit

Permalink
tests - cover not implemented methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Sep 8, 2024
1 parent 6fc9271 commit 422b511
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,15 +154,15 @@ public function map3DPaymentData(array $raw3DAuthResponseData, ?array $rawPaymen
*/
public function map3DPayResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPaymentData($raw3DAuthResponseData, $raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
* {@inheritdoc}
*/
public function map3DHostResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPayResponseData($raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ public function map3DPaymentData(array $raw3DAuthResponseData, ?array $rawPaymen
*/
public function map3DPayResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPaymentData($raw3DAuthResponseData, $raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
* {@inheritdoc}
*/
public function map3DHostResponseData(array $raw3DAuthResponseData, string $txType, array $order): array
{
return $this->map3DPayResponseData($raw3DAuthResponseData, $txType, $order);
throw new NotImplementedException();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Mews\Pos\DataMapper\RequestDataMapper\PosNetRequestDataMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PosNetResponseDataMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\CryptFactory;
use Mews\Pos\Gateways\PosNet;
use Mews\Pos\PosInterface;
Expand Down Expand Up @@ -139,6 +140,23 @@ public function testMapRefundResponse(array $responseData, array $expectedData):
$this->assertSame($expectedData, $actualData);
}

public function testMapHistoryResponse(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->mapHistoryResponse([]);
}

public function testMap3DPayResponseData(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->map3DPayResponseData([], PosInterface::TX_TYPE_PAY_AUTH, []);
}

public function testMap3DHostResponseData(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->map3DHostResponseData([], PosInterface::TX_TYPE_PAY_AUTH, []);
}

public function paymentTestDataProvider(): array
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Mews\Pos\DataMapper\RequestDataMapper\PosNetV1PosRequestDataMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PosNetV1PosResponseDataMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\CryptFactory;
use Mews\Pos\Gateways\PosNetV1Pos;
use Mews\Pos\PosInterface;
Expand Down Expand Up @@ -148,6 +149,29 @@ public function testMapRefundResponse(array $responseData, array $expectedData):
$this->assertSame($expectedData, $actualData);
}

public function testMapHistoryResponse(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->mapHistoryResponse([]);
}

public function testMapOrderHistoryResponse(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->mapOrderHistoryResponse([]);
}

public function testMap3DPayResponseData(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->map3DPayResponseData([], PosInterface::TX_TYPE_PAY_AUTH, []);
}

public function testMap3DHostResponseData(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->map3DHostResponseData([], PosInterface::TX_TYPE_PAY_AUTH, []);
}

public static function paymentTestDataProvider(): iterable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Mews\Pos\DataMapper\RequestDataMapper\ToslaPosRequestDataMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\ToslaPosResponseDataMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\CryptFactory;
use Mews\Pos\Gateways\ToslaPos;
use Mews\Pos\PosInterface;
Expand Down Expand Up @@ -169,7 +170,7 @@ public function testMapCancelResponse(array $responseData, array $expectedData):
/**
* @dataProvider orderHistoryDataProvider
*/
public function testMapHistoryResponse(array $responseData, array $expectedData): void
public function testMapOrderHistoryResponse(array $responseData, array $expectedData): void
{
$actualData = $this->responseDataMapper->mapOrderHistoryResponse($responseData);
if (isset($responseData['Transactions'])) {
Expand Down Expand Up @@ -203,6 +204,18 @@ public function testMapHistoryResponse(array $responseData, array $expectedData)
$this->assertSame($expectedData, $actualData);
}

public function testMap3DPaymentResponseData(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->map3DPaymentData([], [], PosInterface::TX_TYPE_PAY_AUTH, []);
}

public function testMapHistoryResponse(): void
{
$this->expectException(NotImplementedException::class);
$this->responseDataMapper->mapHistoryResponse([]);
}

public static function paymentDataProvider(): iterable
{
yield 'success1' => [
Expand Down

0 comments on commit 422b511

Please sign in to comment.