-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #396 from omise/release-v5.3.0
Preparing release v5.3.0
- Loading branch information
Showing
10 changed files
with
129 additions
and
32 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
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,35 @@ | ||
<?php | ||
|
||
use PHPunit\Framework\TestCase; | ||
use Mockery; | ||
|
||
abstract class Offsite_Test extends TestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
// Mocking the parent class | ||
$offsite = Mockery::mock('overload:Omise_Payment_Offsite'); | ||
$offsite->shouldReceive('init_settings'); | ||
$offsite->shouldReceive('get_option'); | ||
$offsite->shouldReceive('get_provider'); | ||
|
||
// mocking WP built-in functions | ||
if (!function_exists('wp_kses')) { | ||
function wp_kses() {} | ||
} | ||
|
||
if (!function_exists('add_action')) { | ||
function add_action() {} | ||
} | ||
|
||
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php'; | ||
} | ||
|
||
/** | ||
* close mockery after tests are done | ||
*/ | ||
public function teardown(): void | ||
{ | ||
Mockery::close(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/unit/includes/gateway/class-omise-payment-alipayplus-hk-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,23 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/class-omise-offsite-test.php'; | ||
|
||
class Omise_Payment_Alipay_Hk_Test extends Offsite_Test | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function restrictedCountriesHasRequiredCountries() | ||
{ | ||
$obj = new Omise_Payment_Alipay_Hk(); | ||
$expectedCountries = ['SG', 'TH']; | ||
|
||
$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
tests/unit/includes/gateway/class-omise-payment-alipayplus-kakaopay-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,23 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/class-omise-offsite-test.php'; | ||
|
||
class Omise_Payment_Kakaopay_Test extends Offsite_Test | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-alipayplus.php'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function restrictedCountriesHasRequiredCountries() | ||
{ | ||
$obj = new Omise_Payment_Kakaopay(); | ||
$expectedCountries = ['SG', 'TH']; | ||
|
||
$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries); | ||
} | ||
} |
28 changes: 3 additions & 25 deletions
28
tests/unit/includes/gateway/class-omise-payment-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
23 changes: 23 additions & 0 deletions
23
tests/unit/includes/gateway/class-omise-payment-touch-n-go-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,23 @@ | ||
<?php | ||
|
||
require_once __DIR__ . '/class-omise-offsite-test.php'; | ||
|
||
class Omise_Payment_TouchNGo_Test extends Offsite_Test | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
require_once __DIR__ . '/../../../../includes/gateway/class-omise-payment-touch-n-go.php'; | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function restrictedCountriesHasRequiredCountries() | ||
{ | ||
$obj = new Omise_Payment_TouchNGo(); | ||
$expectedCountries = ['SG', 'MY', 'TH']; | ||
|
||
$this->assertEqualsCanonicalizing($expectedCountries, $obj->restricted_countries); | ||
} | ||
} |