-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review and add White Label Installments (#492)
* Add WLB installment banks in providers in omise-offsite-installment-method.js. Removed unnecesssary files from offsite-installment-form.html. Updated Model/Config/Installment.php. Few other minor improvements. * Refactored /omise-offsite-installment-method.js * Move installment_wlb_ktc to a new line. * Add test for Model/Api/Capabilities
- Loading branch information
1 parent
128bfab
commit b66bcd6
Showing
7 changed files
with
127 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
namespace Omise\Payment\Test\Unit\Model\Api; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Omise\Payment\Model\Api\Capabilities; | ||
use Omise\Payment\Model\Config\Config; | ||
use Mockery as m; | ||
|
||
class CapabilitiesTest extends TestCase | ||
{ | ||
private $configMock; | ||
private $omiseCapabilitiesMock; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->configMock = m::mock(Config::class); | ||
$this->configMock->shouldReceive('canInitialize')->andReturn(true); | ||
$this->omiseCapabilitiesMock = m::mock('alias:OmiseCapabilities'); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
m::close(); | ||
} | ||
|
||
/** | ||
* @covers Omise\Payment\Model\Api\Capabilities | ||
*/ | ||
public function testGetInstallmentMinLimit() | ||
{ | ||
$data = [ | ||
'limits' => [ | ||
'installment_amount' => [ | ||
'min' => 3000 | ||
] | ||
] | ||
]; | ||
$this->omiseCapabilitiesMock->shouldReceive('retrieve')->andReturn($data); | ||
$capabilities = new Capabilities($this->configMock); | ||
$result = $capabilities->getInstallmentMinLimit(); | ||
|
||
$this->assertEquals($data['limits']['installment_amount']['min'], $result); | ||
} | ||
|
||
/** | ||
* @covers Omise\Payment\Model\Api\Capabilities | ||
*/ | ||
public function testGetInstallmentMinLimitReturnsZeroIfCapabilitiesIsNotSet() | ||
{ | ||
$this->omiseCapabilitiesMock->shouldReceive('retrieve')->andReturn(null); | ||
$capabilities = new Capabilities($this->configMock); | ||
$result = $capabilities->getInstallmentMinLimit(); | ||
|
||
$this->assertEquals(0, $result); | ||
} | ||
} |
Oops, something went wrong.