You are here

function Braintree_CreditCardTest::testExpiringBetween in Commerce Braintree 7

File

braintree_php/tests/integration/CreditCardTest.php, line 535

Class

Braintree_CreditCardTest

Code

function testExpiringBetween() {
  $collection = Braintree_CreditCard::expiringBetween(mktime(0, 0, 0, 1, 1, 2010), mktime(23, 59, 59, 12, 31, 2010));
  $this
    ->assertTrue($collection
    ->maximumCount() > 1);
  $arr = array();
  foreach ($collection as $creditCard) {
    $this
      ->assertEquals('2010', $creditCard->expirationYear);
    array_push($arr, $creditCard->token);
  }
  $uniqueCreditCardTokens = array_unique(array_values($arr));
  $this
    ->assertEquals($collection
    ->maximumCount(), count($uniqueCreditCardTokens));
}