-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add code coverage for omise-block-duitnow-obw.php and omise-block-fpx…
….php
- Loading branch information
Aashish
committed
Jun 5, 2024
1 parent
a9750e0
commit 19ef73f
Showing
5 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
tests/unit/includes/blocks/gateways/omise-block-duitnow-obw-test.php
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,36 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Brain\Monkey; | ||
|
||
class Omise_Block_DuitNow_OBW_Test extends TestCase | ||
{ | ||
use MockPaymentGateways; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->mockWcGateways(); | ||
require_once __DIR__ . '/../../../../../includes/blocks/gateways/abstract-omise-block-payment.php'; | ||
require_once __DIR__ . '/../../../../../includes/blocks/gateways/omise-block-duitnow-obw.php'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function set_additional_data() | ||
{ | ||
Monkey\Functions\expect('get_option')->andReturn(null); | ||
$obj = new Omise_Block_DuitNow_OBW; | ||
$obj->initialize(); | ||
$obj->set_additional_data(); | ||
|
||
$clazz = new \ReflectionClass($obj); | ||
$property = $clazz->getProperty('additional_data'); | ||
$property->setAccessible(true); | ||
$result = $property->getValue($obj); | ||
|
||
$this->assertIsArray($result); | ||
$this->assertArrayHasKey('banks', $result); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/unit/includes/blocks/gateways/omise-block-fpx-test.php
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,36 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Brain\Monkey; | ||
|
||
class Omise_Block_FPX_Test extends TestCase | ||
{ | ||
use MockPaymentGateways; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->mockWcGateways(); | ||
require_once __DIR__ . '/../../../../../includes/blocks/gateways/abstract-omise-block-payment.php'; | ||
require_once __DIR__ . '/../../../../../includes/blocks/gateways/omise-block-fpx.php'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function set_additional_data() | ||
{ | ||
Monkey\Functions\expect('get_option')->andReturn(null); | ||
$obj = new Omise_Block_Fpx; | ||
$obj->initialize(); | ||
$obj->set_additional_data(); | ||
|
||
$clazz = new \ReflectionClass($obj); | ||
$property = $clazz->getProperty('additional_data'); | ||
$property->setAccessible(true); | ||
$result = $property->getValue($obj); | ||
|
||
$this->assertIsArray($result); | ||
$this->assertArrayHasKey('bank_list', $result); | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
tests/unit/includes/blocks/gateways/omise-block-installment-test.php
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