You are here

function Braintree_TransactionAdvancedSearchTest::test_rangeNode_authorizationExpiredAt in Commerce Braintree 7

File

braintree_php/tests/integration/TransactionAdvancedSearchTest.php, line 873

Class

Braintree_TransactionAdvancedSearchTest

Code

function test_rangeNode_authorizationExpiredAt() {
  $two_days_ago = date_create("now -2 days", new DateTimeZone("UTC"));
  $yesterday = date_create("now -1 day", new DateTimeZone("UTC"));
  $tomorrow = date_create("now +1 day", new DateTimeZone("UTC"));
  $collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::authorizationExpiredAt()
      ->between($two_days_ago, $yesterday),
  ));
  $this
    ->assertEquals(0, $collection
    ->maximumCount());
  $collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::authorizationExpiredAt()
      ->between($yesterday, $tomorrow),
  ));
  $this
    ->assertGreaterThan(0, $collection
    ->maximumCount());
  $this
    ->assertEquals(Braintree_Transaction::AUTHORIZATION_EXPIRED, $collection
    ->firstItem()->status);
}