Skip to content

Commit

Permalink
tests: add config tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiano-mallmann committed Jun 24, 2024
1 parent 098ed18 commit 0271d86
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Test/Unit/Gateway/Transaction/GooglePay/Config/ConfigTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace Pagarme\Pagarme\Test\Unit\Gateway\Transaction\GooglePay\Config;

use Pagarme\Pagarme\Test\Unit\BaseTest;
use Pagarme\Pagarme\Gateway\Transaction\GooglePay\Config\Config;

class ConfigTest extends BaseTest
{
public function testGetCardBrandsIfOnlyOneBrandActive()
{
$config = \Mockery::mock(Config::class)->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);
}
}

0 comments on commit 0271d86

Please sign in to comment.