From a4dc8d320b3855a6bab66280283c953cf4090fce Mon Sep 17 00:00:00 2001 From: mustapayev Date: Wed, 25 Sep 2024 16:05:35 +0200 Subject: [PATCH] crypt tests - replace NullLogger usages --- tests/Unit/Crypt/AkbankPosCryptTest.php | 5 +++-- tests/Unit/Crypt/EstPosCryptTest.php | 6 ++++-- tests/Unit/Crypt/EstV3PosCryptTest.php | 9 +++++++-- tests/Unit/Crypt/GarantiPosCryptTest.php | 6 ++++-- tests/Unit/Crypt/InterPosCryptTest.php | 5 +++-- tests/Unit/Crypt/KuveytPosCryptTest.php | 6 ++++-- tests/Unit/Crypt/PayFlexCP4CryptTest.php | 5 +++-- tests/Unit/Crypt/PayForPosCryptTest.php | 6 ++++-- tests/Unit/Crypt/PosNetCryptTest.php | 6 ++++-- tests/Unit/Crypt/PosNetV1PosCryptTest.php | 5 +++-- tests/Unit/Crypt/ToslaPosCryptTest.php | 6 ++++-- 11 files changed, 43 insertions(+), 22 deletions(-) diff --git a/tests/Unit/Crypt/AkbankPosCryptTest.php b/tests/Unit/Crypt/AkbankPosCryptTest.php index 11347c8a..a07f4182 100644 --- a/tests/Unit/Crypt/AkbankPosCryptTest.php +++ b/tests/Unit/Crypt/AkbankPosCryptTest.php @@ -13,7 +13,7 @@ use Mews\Pos\PosInterface; use Mews\Pos\Tests\Unit\DataMapper\ResponseDataMapper\AkbankPosResponseDataMapperTest; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\AkbankPosCrypt @@ -38,7 +38,8 @@ protected function setUp(): void 'sub-2023090417500272654BD9A49CF07574' ); - $this->crypt = new AkbankPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new AkbankPosCrypt($logger); } public function testGenerateRandomString(): void diff --git a/tests/Unit/Crypt/EstPosCryptTest.php b/tests/Unit/Crypt/EstPosCryptTest.php index 0394f19d..a7ead888 100644 --- a/tests/Unit/Crypt/EstPosCryptTest.php +++ b/tests/Unit/Crypt/EstPosCryptTest.php @@ -10,10 +10,11 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\EstPosCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class EstPosCryptTest extends TestCase { @@ -34,7 +35,8 @@ protected function setUp(): void 'TRPS0200' ); - $this->crypt = new EstPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new EstPosCrypt($logger); } public function testCreate3DHash(): void diff --git a/tests/Unit/Crypt/EstV3PosCryptTest.php b/tests/Unit/Crypt/EstV3PosCryptTest.php index 9aad6a77..85b5da39 100644 --- a/tests/Unit/Crypt/EstV3PosCryptTest.php +++ b/tests/Unit/Crypt/EstV3PosCryptTest.php @@ -1,4 +1,7 @@ crypt = new EstV3PosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new EstV3PosCrypt($logger); } /** diff --git a/tests/Unit/Crypt/GarantiPosCryptTest.php b/tests/Unit/Crypt/GarantiPosCryptTest.php index 8478c7a0..4d4e3b93 100644 --- a/tests/Unit/Crypt/GarantiPosCryptTest.php +++ b/tests/Unit/Crypt/GarantiPosCryptTest.php @@ -10,10 +10,11 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\GarantiPosCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class GarantiPosCryptTest extends TestCase { @@ -37,7 +38,8 @@ protected function setUp(): void '123qweASD/' ); - $this->crypt = new GarantiPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new GarantiPosCrypt($logger); } /** diff --git a/tests/Unit/Crypt/InterPosCryptTest.php b/tests/Unit/Crypt/InterPosCryptTest.php index dda54c6b..31cadff9 100644 --- a/tests/Unit/Crypt/InterPosCryptTest.php +++ b/tests/Unit/Crypt/InterPosCryptTest.php @@ -12,7 +12,7 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\InterPosCrypt @@ -42,7 +42,8 @@ protected function setUp(): void $merchantPass ); - $this->crypt = new InterPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new InterPosCrypt($logger); } /** diff --git a/tests/Unit/Crypt/KuveytPosCryptTest.php b/tests/Unit/Crypt/KuveytPosCryptTest.php index 636a2801..fca32762 100644 --- a/tests/Unit/Crypt/KuveytPosCryptTest.php +++ b/tests/Unit/Crypt/KuveytPosCryptTest.php @@ -11,10 +11,11 @@ use Mews\Pos\Exceptions\NotImplementedException; use Mews\Pos\Factory\AccountFactory; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\KuveytPosCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class KuveytPosCryptTest extends TestCase { @@ -34,7 +35,8 @@ protected function setUp(): void 'Api123' ); - $this->crypt = new KuveytPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new KuveytPosCrypt($logger); } public function testHashString(): void diff --git a/tests/Unit/Crypt/PayFlexCP4CryptTest.php b/tests/Unit/Crypt/PayFlexCP4CryptTest.php index 2aa9f976..8ce8dd35 100644 --- a/tests/Unit/Crypt/PayFlexCP4CryptTest.php +++ b/tests/Unit/Crypt/PayFlexCP4CryptTest.php @@ -11,7 +11,7 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\PayFlexCPV4Crypt @@ -35,7 +35,8 @@ protected function setUp(): void PosInterface::MODEL_3D_SECURE ); - $this->crypt = new PayFlexCPV4Crypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new PayFlexCPV4Crypt($logger); } diff --git a/tests/Unit/Crypt/PayForPosCryptTest.php b/tests/Unit/Crypt/PayForPosCryptTest.php index 69f15c24..b4ec9067 100644 --- a/tests/Unit/Crypt/PayForPosCryptTest.php +++ b/tests/Unit/Crypt/PayForPosCryptTest.php @@ -9,10 +9,11 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\PayForPosCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class PayForPosCryptTest extends TestCase { @@ -33,7 +34,8 @@ protected function setUp(): void '12345678' ); - $this->crypt = new PayForPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new PayForPosCrypt($logger); } diff --git a/tests/Unit/Crypt/PosNetCryptTest.php b/tests/Unit/Crypt/PosNetCryptTest.php index f9bed5bb..65df30ec 100644 --- a/tests/Unit/Crypt/PosNetCryptTest.php +++ b/tests/Unit/Crypt/PosNetCryptTest.php @@ -9,10 +9,11 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\PosNetCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class PosNetCryptTest extends TestCase { @@ -33,7 +34,8 @@ protected function setUp(): void '10,10,10,10,10,10,10,10' ); - $this->crypt = new PosNetCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new PosNetCrypt($logger); } diff --git a/tests/Unit/Crypt/PosNetV1PosCryptTest.php b/tests/Unit/Crypt/PosNetV1PosCryptTest.php index 474ee33c..51b761c5 100644 --- a/tests/Unit/Crypt/PosNetV1PosCryptTest.php +++ b/tests/Unit/Crypt/PosNetV1PosCryptTest.php @@ -9,7 +9,7 @@ use Mews\Pos\Factory\AccountFactory; use Mews\Pos\PosInterface; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\PosNetV1PosCrypt @@ -34,7 +34,8 @@ protected function setUp(): void '10,10,10,10,10,10,10,10' ); - $this->crypt = new PosNetV1PosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new PosNetV1PosCrypt($logger); } /** diff --git a/tests/Unit/Crypt/ToslaPosCryptTest.php b/tests/Unit/Crypt/ToslaPosCryptTest.php index b8c6ea62..a4938564 100644 --- a/tests/Unit/Crypt/ToslaPosCryptTest.php +++ b/tests/Unit/Crypt/ToslaPosCryptTest.php @@ -9,10 +9,11 @@ use Mews\Pos\Entity\Account\ToslaPosAccount; use Mews\Pos\Factory\AccountFactory; use PHPUnit\Framework\TestCase; -use Psr\Log\NullLogger; +use Psr\Log\LoggerInterface; /** * @covers \Mews\Pos\Crypt\ToslaPosCrypt + * @covers \Mews\Pos\Crypt\AbstractCrypt */ class ToslaPosCryptTest extends TestCase { @@ -31,7 +32,8 @@ protected function setUp(): void 'POS_ENT_Test_001!*!*', ); - $this->crypt = new ToslaPosCrypt(new NullLogger()); + $logger = $this->createMock(LoggerInterface::class); + $this->crypt = new ToslaPosCrypt($logger); } public function testCreate3DHash(): void