From 0271d864279f2747b6478caf1fac60b2affd91e9 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Mon, 24 Jun 2024 17:08:34 -0300 Subject: [PATCH] tests: add config tests --- .../GooglePay/Config/ConfigTest.php | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Test/Unit/Gateway/Transaction/GooglePay/Config/ConfigTest.php diff --git a/Test/Unit/Gateway/Transaction/GooglePay/Config/ConfigTest.php b/Test/Unit/Gateway/Transaction/GooglePay/Config/ConfigTest.php new file mode 100644 index 00000000..e0d087c4 --- /dev/null +++ b/Test/Unit/Gateway/Transaction/GooglePay/Config/ConfigTest.php @@ -0,0 +1,37 @@ +makePartial(['getConfig']); + $config->shouldAllowMockingProtectedMethods(); + $config->shouldReceive('getConfig')->andReturn('visa'); + $allowedBrands = $config->getCardBrands(); + $this->assertIsArray($allowedBrands); + $this->assertEquals(['VISA'], $allowedBrands); + } + public function testGetCardBrandsIfTwoBrandsActives() + { + $config = \Mockery::mock(Config::class)->makePartial(['getConfig']); + $config->shouldAllowMockingProtectedMethods(); + $config->shouldReceive('getConfig')->andReturn('visa,mastercard'); + $allowedBrands = $config->getCardBrands(); + $this->assertIsArray($allowedBrands); + $this->assertEquals(['VISA', 'MASTERCARD'], $allowedBrands); + } + + public function testGetCardBrandsWithBrandNotAllowedForGooglePay() + { + $config = \Mockery::mock(Config::class)->makePartial(['getConfig']); + $config->shouldAllowMockingProtectedMethods(); + $config->shouldReceive('getConfig')->andReturn('visa,jcb'); + $allowedBrands = $config->getCardBrands(); + $this->assertIsArray($allowedBrands); + $this->assertEquals(['VISA'], $allowedBrands); + } +}