From a431c86bb266e6ec5e673e20ca1adac90e35ae85 Mon Sep 17 00:00:00 2001 From: andy Date: Sun, 17 Apr 2022 08:35:52 +0000 Subject: [PATCH] Fix phpunit tests --- .gitignore | 3 +++ modules/gateways/xendit.php | 1 + modules/gateways/xendit/lib/ActionBase.php | 2 +- modules/gateways/xendit/lib/Migrate.php | 2 +- modules/gateways/xendit/phpunit.xml.dist | 12 ++++++++++-- .../gateways/xendit/tests/WHMCSModuleTest.php | 16 ++++++++++------ 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index a97cbd5..87c1b75 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ modules/gateways/* !modules/gateways/callback/ modules/gateways/callback/* !modules/gateways/callback/xendit.php + +modules/gateways/xendit/composer.lock +modules/gateways/xendit/.phpunit.result.cache diff --git a/modules/gateways/xendit.php b/modules/gateways/xendit.php index 567f63e..0803ac8 100644 --- a/modules/gateways/xendit.php +++ b/modules/gateways/xendit.php @@ -4,6 +4,7 @@ } //autoload gateway functions +require_once __DIR__ . '/../../init.php'; require_once __DIR__ . '/../../includes/gatewayfunctions.php'; require __DIR__ . '/xendit/autoload.php'; diff --git a/modules/gateways/xendit/lib/ActionBase.php b/modules/gateways/xendit/lib/ActionBase.php index 3253409..d723062 100644 --- a/modules/gateways/xendit/lib/ActionBase.php +++ b/modules/gateways/xendit/lib/ActionBase.php @@ -2,7 +2,7 @@ namespace Xendit\Lib; -use WHMCS\Database\Capsule; +use Illuminate\Database\Capsule\Manager as Capsule; use Illuminate\Database\Query\Builder as QueryBuilder; use Xendit\Lib\Model\XenditTransaction; use Xendit\Lib\XenditRequest; diff --git a/modules/gateways/xendit/lib/Migrate.php b/modules/gateways/xendit/lib/Migrate.php index 9ff7a87..235bb70 100644 --- a/modules/gateways/xendit/lib/Migrate.php +++ b/modules/gateways/xendit/lib/Migrate.php @@ -1,7 +1,7 @@ - + + + . + + + vendor/ + tests/ + + - tests/* + tests/ diff --git a/modules/gateways/xendit/tests/WHMCSModuleTest.php b/modules/gateways/xendit/tests/WHMCSModuleTest.php index 5fed871..da1f8cd 100644 --- a/modules/gateways/xendit/tests/WHMCSModuleTest.php +++ b/modules/gateways/xendit/tests/WHMCSModuleTest.php @@ -14,7 +14,9 @@ * @copyright Copyright (c) WHMCS Limited 2017 * @license http://www.whmcs.com/license/ WHMCS Eula */ -class WHMCSModuleTest extends PHPUnit_Framework_TestCase +use PHPUnit\Framework\TestCase; + +class WHMCSModuleTest extends TestCase { /** @var string $moduleName */ protected $moduleName = 'xendit'; @@ -33,11 +35,13 @@ public function testRequiredConfigOptionsFunctionExists() public function testRequiredConfigOptionsParametersAreDefined() { $result = call_user_func($this->moduleName . '_config'); - $this->assertArrayHasKey('name', $result); + $this->assertArrayHasKey('FriendlyName', $result); $this->assertArrayHasKey('description', $result); - $this->assertArrayHasKey('author', $result); - $this->assertArrayHasKey('language', $result); - $this->assertArrayHasKey('version', $result); - $this->assertArrayHasKey('fields', $result); + $this->assertArrayHasKey('xenditTestMode', $result); + $this->assertArrayHasKey('xenditTestPublicKey', $result); + $this->assertArrayHasKey('xenditTestSecretKey', $result); + $this->assertArrayHasKey('xenditPublicKey', $result); + $this->assertArrayHasKey('xenditSecretKey', $result); + $this->assertArrayHasKey('xenditExternalPrefix', $result); } }