Skip to content

Commit 3b14fa1

Browse files
committed
add unit testing for paymentMethodToken
1 parent ad95646 commit 3b14fa1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/Message/AuthorizeRequestTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function testGetData()
3535
{
3636
$data = $this->request->getData();
3737

38+
$this->assertArrayNotHasKey('paymentMethodToken', $data);
3839
$this->assertSame('abc123', $data['paymentMethodNonce']);
3940
$this->assertSame('10.00', $data['amount']);
4041
$this->assertSame('684', $data['orderId']);
@@ -50,6 +51,28 @@ public function testGetData()
5051
$this->assertSame('production', \Braintree_Configuration::environment());
5152
}
5253

54+
public function testPaymentToken()
55+
{
56+
$this->request->initialize(
57+
array(
58+
'amount' => '10.00',
59+
'token' => 'abc123',
60+
'transactionId' => '684',
61+
'testMode' => false,
62+
'taxExempt' => false,
63+
'card' => [
64+
'firstName' => 'Kayla',
65+
'shippingCompany' => 'League',
66+
],
67+
'usePaymentMethodToken' => true
68+
)
69+
);
70+
71+
$data = $this->request->getData();
72+
$this->assertSame('abc123', $data['paymentMethodToken']);
73+
$this->assertArrayNotHasKey('paymentMethodNonce', $data);
74+
}
75+
5376
public function testSandboxEnvironment()
5477
{
5578
$this->request->setTestMode(true);

0 commit comments

Comments
 (0)