Skip to content

Commit

Permalink
Add test for payment request due date.
Browse files Browse the repository at this point in the history
  • Loading branch information
rvdsteege committed Oct 14, 2019
1 parent 77d779c commit 14a1b4c
Showing 1 changed file with 45 additions and 4 deletions.
49 changes: 45 additions & 4 deletions tests/src/PaymentRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@
*/
class PaymentRequestTest extends \PHPUnit_Framework_TestCase {
/**
* Test payment request.
* Payment request.
*
* @var PaymentRequest
*/
public function test_payment_request() {
private $request;

/**
* Setup.
*/
public function setUp() {
$request = new PaymentRequest();

$amount = new Amount( 'EUR', '100.00' );
Expand All @@ -39,20 +46,54 @@ public function test_payment_request() {
$request->customer_id = 'cst_8wmqcHMN4U';
$request->sequence_type = Sequence::FIRST;

$this->request = $request;
}
/**
* Test payment request.
*/
public function test_payment_request() {
$this->assertEquals(
array(
'amount' => $this->request->amount->get_json(),
'description' => 'Test',
'redirectUrl' => 'https://example.com/mollie-redirect/',
'webhookUrl' => 'https://example.com/mollie-webhook/',
'method' => 'ideal',
'metadata' => 'meta',
'locale' => 'nl_NL',
'issuer' => 'ideal_INGBNL2A',
'customerId' => 'cst_8wmqcHMN4U',
'sequenceType' => 'first',
),
$this->request->get_array()
);
}

/**
* Test due date.
*
* @throws \Exception Throws exception on date error.
*/
public function test_due_date() {
$due_date = new \DateTime( '+12 days' );

$this->request->set_due_date( $due_date );

$this->assertEquals(
array(
'amount' => $amount->get_json(),
'amount' => $this->request->amount->get_json(),
'description' => 'Test',
'redirectUrl' => 'https://example.com/mollie-redirect/',
'webhookUrl' => 'https://example.com/mollie-webhook/',
'method' => 'ideal',
'metadata' => 'meta',
'locale' => 'nl_NL',
'issuer' => 'ideal_INGBNL2A',
'dueDate' => $due_date->format( 'Y-m-d' ),
'customerId' => 'cst_8wmqcHMN4U',
'sequenceType' => 'first',
),
$request->get_array()
$this->request->get_array()
);
}
}

0 comments on commit 14a1b4c

Please sign in to comment.