![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/job-board.corals.io/vendor/xendit/xendit-php/tests/Xendit/ |
<?php /** * PayoutsTest.php * php version 7.2.0 * * @category Test * @package Xendit * @author Ellen <[email protected]> * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ use Xendit\Payouts; use Xendit\TestCase; /** * Class PayoutsTest * * @category Class * @package Xendit * @author Ellen <[email protected]> * @license https://opensource.org/licenses/MIT MIT License * @link https://api.xendit.co */ class PayoutsTest extends TestCase { const TEST_ID = "TEST-123"; /** * Create Payout test * Should pass * * @return void */ public function testIsCreatable() { $params = [ 'external_id'=> 'payouts-123456789', 'amount'=> 50000, 'email'=> '[email protected]', ]; $this->stubRequest( 'POST', '/payouts', $params, [], $params ); $result = Payouts::create($params); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); $this->assertEquals($result['email'], $params['email']); } /** * Get Payout test * Should pass * * @return void */ public function testIsGettable() { $params = [ 'external_id'=> 'payouts-123456789', 'amount'=> 50000 ]; $this->stubRequest( 'GET', '/payouts/' . self::TEST_ID, [], [], $params ); $result = Payouts::retrieve(self::TEST_ID); $this->assertEquals($result['external_id'], $params['external_id']); $this->assertEquals($result['amount'], $params['amount']); } /** * Void Payout test * Should pass * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsVoidable() { $this->stubRequest( 'POST', '/payouts/' . self::TEST_ID . '/void', [], [], [ 'id' => self::TEST_ID ] ); $result = Payouts::void(self::TEST_ID); $this->assertEquals($result['id'], self::TEST_ID); } /** * Create Payout test * Should throw InvalidArgumentException * * @return void */ public function testIsCreatableThrowInvalidArgumentException() { $this->expectException(\Xendit\Exceptions\InvalidArgumentException::class); $params = [ 'external_id' => 'demo_147580196270' ]; Payouts::create($params); } /** * Get Payout test * Should throw ApiException * * @return void */ public function testIsGettableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Payouts::retrieve(self::TEST_ID); } /** * Void Payout test * Should throw * * @return void * @throws \Xendit\Exceptions\ApiException */ public function testIsVoidableThrowApiException() { $this->expectException(\Xendit\Exceptions\ApiException::class); Payouts::void(self::TEST_ID); } }