Skip to content

Commit

Permalink
Fix phpunit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andykim committed Apr 17, 2022
1 parent 6dfd4a6 commit a431c86
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions modules/gateways/xendit.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
}

//autoload gateway functions
require_once __DIR__ . '/../../init.php';
require_once __DIR__ . '/../../includes/gatewayfunctions.php';

require __DIR__ . '/xendit/autoload.php';
Expand Down
2 changes: 1 addition & 1 deletion modules/gateways/xendit/lib/ActionBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion modules/gateways/xendit/lib/Migrate.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Xendit\lib;

use WHMCS\Database\Capsule;
use Illuminate\Database\Capsule\Manager as Capsule;

class Migrate
{
Expand Down
12 changes: 10 additions & 2 deletions modules/gateways/xendit/phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="tests/_bootstrap.php">
<coverage/>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">.</directory>
</include>
<exclude>
<directory>vendor/</directory>
<directory>tests/</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="WHMCS Xendit Payment Gateway Tests">
<directory suffix=".php">tests/*</directory>
<directory suffix=".php">tests/</directory>
</testsuite>
</testsuites>
</phpunit>
16 changes: 10 additions & 6 deletions modules/gateways/xendit/tests/WHMCSModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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);
}
}

0 comments on commit a431c86

Please sign in to comment.