You are here

function Braintree_CustomerTest::testCreateFromTransparentRedirect in Commerce Braintree 7

File

braintree_php/tests/integration/CustomerTest.php, line 590

Class

Braintree_CustomerTest

Code

function testCreateFromTransparentRedirect() {
  Braintree_TestHelper::suppressDeprecationWarnings();
  $queryString = $this
    ->createCustomerViaTr(array(
    'customer' => array(
      'first_name' => 'Joe',
      'last_name' => 'Martin',
      'credit_card' => array(
        'number' => '5105105105105100',
        'expiration_date' => '05/12',
      ),
    ),
  ), array());
  $result = Braintree_Customer::createFromTransparentRedirect($queryString);
  $this
    ->assertTrue($result->success);
  $this
    ->assertEquals('Joe', $result->customer->firstName);
  $this
    ->assertEquals('Martin', $result->customer->lastName);
  $creditCard = $result->customer->creditCards[0];
  $this
    ->assertEquals('510510', $creditCard->bin);
  $this
    ->assertEquals('5100', $creditCard->last4);
  $this
    ->assertEquals('05/2012', $creditCard->expirationDate);
}