-
Notifications
You must be signed in to change notification settings - Fork 10
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 #6 from blessedjasonmwanza/php-library
Feat: Add Verify payment feature, tests and documentation
- Loading branch information
Showing
5 changed files
with
107 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
} | ||
], | ||
"require": { | ||
"php": ">=7.0" | ||
"php": ">=7.4" | ||
}, | ||
"license": "MIT", | ||
"require-dev": { | ||
|
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,32 @@ | ||
<?php | ||
|
||
use Blessedjasonmwanza\MoneyUnify\MoneyUnify; | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
describe('Expect verifyPayment feature to work properly', function () { | ||
$muid = '123'; // Presumably invalid muid for testing | ||
$moneyUnify = new MoneyUnify ($muid); | ||
$requestToPay = $moneyUnify->verifyPayment('0975555555_1713447717'); | ||
|
||
// Test if the result is a valid object | ||
it('is a valid object', function () use ($requestToPay) { | ||
expect($requestToPay)->toBeObject(); // Ensure the response is an object | ||
}); | ||
|
||
// Test if the object has required properties | ||
it('has message and isError properties', function () use ($requestToPay) { | ||
expect($requestToPay)->toHaveProperty('message'); // Checks if 'message' exists | ||
expect($requestToPay)->toHaveProperty('isError'); // Checks if 'isError' exists | ||
}); | ||
|
||
// Test for invalid muid resulting in isError being true | ||
it('isError property is true due to invalid muid', function () use ($requestToPay) { | ||
expect($requestToPay->isError)->toBeTrue(); // As the muid is invalid, isError should be true | ||
}); | ||
|
||
// Test if the 'console' property is present in case of an error | ||
it('has console property due to invalid muid', function () use ($requestToPay) { | ||
expect($requestToPay)->toHaveProperty('console'); // Error responses typically include console data | ||
}); | ||
}); |