Skip to content

Commit

Permalink
tests - use factories to create response value mappers
Browse files Browse the repository at this point in the history
  • Loading branch information
mustapayev committed Oct 27, 2024
1 parent 63b68a5 commit ad2658e
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\AkbankPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\AkbankPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\AkbankPosResponseValueMapper;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\AkbankPos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -31,13 +32,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new AkbankPosRequestValueMapper();
$responseValueFormatter = new BasicResponseValueFormatter();
$responseValueMapper = new AkbankPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(AkbankPos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(AkbankPos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(AkbankPos::class);

$this->responseDataMapper = new AkbankPosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\EstPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\EstPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\EstPosResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\EstPosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\EstV3Pos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new EstPosRequestValueMapper();
$responseValueFormatter = new EstPosResponseValueFormatter();
$responseValueMapper = new EstPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(EstV3Pos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(EstV3Pos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(EstV3Pos::class);

$this->responseDataMapper = new EstPosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\GarantiPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\GarantiPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\GarantiPosResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\GarantiPosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\GarantiPos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new GarantiPosRequestValueMapper();
$responseValueFormatter = new GarantiPosResponseValueFormatter();
$responseValueMapper = new GarantiPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(GarantiPos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(GarantiPos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(GarantiPos::class);

$this->responseDataMapper = new GarantiPosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\InterPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\InterPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\InterPosResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\InterPosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\InterPos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new InterPosRequestValueMapper();
$responseValueFormatter = new InterPosResponseValueFormatter();
$responseValueMapper = new InterPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(InterPos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(InterPos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(InterPos::class);

$this->responseDataMapper = new InterPosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Generator;
use Mews\Pos\DataMapper\RequestValueMapper\PayFlexCPV4PosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PayFlexCPV4PosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\PayFlexCPV4PosResponseValueMapper;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\PayFlexCPV4Pos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,10 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new PayFlexCPV4PosRequestValueMapper();
$responseValueFormatter = new BasicResponseValueFormatter();
$responseValueMapper = new PayFlexCPV4PosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(PayFlexCPV4Pos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(PayFlexCPV4Pos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayFlexCPV4Pos::class);


$this->responseDataMapper = new PayFlexCPV4PosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\PayFlexV4PosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PayFlexV4PosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\PayFlexV4PosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\PayFlexV4Pos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new PayFlexV4PosRequestValueMapper();
$responseValueFormatter = new BasicResponseValueFormatter();
$responseValueMapper = new PayFlexV4PosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(PayFlexV4Pos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(PayFlexV4Pos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayFlexV4Pos::class);

$this->responseDataMapper = new PayFlexV4PosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\PayForPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PayForPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\BasicResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\PayForPosResponseValueMapper;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\PayForPos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -30,13 +31,9 @@ protected function setUp(): void
parent::setUp();
$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new PayForPosRequestValueMapper();
$responseValueFormatter = new BasicResponseValueFormatter();
$responseValueMapper = new PayForPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(PayForPos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(PayForPos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PayForPos::class);

$this->responseDataMapper = new PayForPosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\PosNetRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PosNetResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\PosNetResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\PosNetResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\PosNet;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -31,13 +32,9 @@ protected function setUp(): void
parent::setUp();
$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new PosNetRequestValueMapper();
$responseValueFormatter = new PosNetResponseValueFormatter();
$responseValueMapper = new PosNetResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(PosNet::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(PosNet::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PosNet::class);

$this->responseDataMapper = new PosNetResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\PosNetV1PosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\PosNetV1PosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\PosNetResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\PosNetV1PosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\PosNetV1Pos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -33,13 +34,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new PosNetV1PosRequestValueMapper();
$responseValueFormatter = new PosNetResponseValueFormatter();
$responseValueMapper = new PosNetV1PosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(PosNetV1Pos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(PosNetV1Pos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(PosNetV1Pos::class);

$this->responseDataMapper = new PosNetV1PosResponseDataMapper(
$responseValueFormatter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@

namespace Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper;

use Mews\Pos\DataMapper\RequestValueMapper\ToslaPosRequestValueMapper;
use Mews\Pos\DataMapper\ResponseDataMapper\ToslaPosResponseDataMapper;
use Mews\Pos\DataMapper\ResponseValueFormatter\ToslaPosResponseValueFormatter;
use Mews\Pos\DataMapper\ResponseValueMapper\ToslaPosResponseValueMapper;
use Mews\Pos\Exceptions\NotImplementedException;
use Mews\Pos\Factory\RequestValueMapperFactory;
use Mews\Pos\Factory\ResponseValueFormatterFactory;
use Mews\Pos\Factory\ResponseValueMapperFactory;
use Mews\Pos\Gateways\ToslaPos;
use Mews\Pos\PosInterface;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand All @@ -32,13 +33,9 @@ protected function setUp(): void

$this->logger = $this->createMock(LoggerInterface::class);

$requestValueMapper = new ToslaPosRequestValueMapper();
$responseValueFormatter = new ToslaPosResponseValueFormatter();
$responseValueMapper = new ToslaPosResponseValueMapper(
$requestValueMapper->getCurrencyMappings(),
$requestValueMapper->getTxTypeMappings(),
$requestValueMapper->getSecureTypeMappings()
);
$requestValueMapper = RequestValueMapperFactory::createForGateway(ToslaPos::class);
$responseValueMapper = ResponseValueMapperFactory::createForGateway(ToslaPos::class, $requestValueMapper);
$responseValueFormatter = ResponseValueFormatterFactory::createForGateway(ToslaPos::class);

$this->responseDataMapper = new ToslaPosResponseDataMapper(
$responseValueFormatter,
Expand Down

0 comments on commit ad2658e

Please sign in to comment.