public function test_rangeNode_gatewayRejectedAt() { $old_merchant_id = Braintree\Configuration::merchantId(); $old_public_key = Braintree\Configuration::publicKey(); $old_private_key = Braintree\Configuration::privateKey(); Braintree\Configuration::merchantId('processing_rules_merchant_id'); Braintree\Configuration::publicKey('processing_rules_public_key'); Braintree\Configuration::privateKey('processing_rules_private_key'); $transaction = Braintree\Transaction::sale(['amount' => '1000.00', 'creditCard' => ['number' => '4111111111111111', 'expirationDate' => '05/12', 'cvv' => '200']])->transaction; $twenty_min_ago = date_create("now -20 minutes", new DateTimeZone("UTC")); $ten_min_ago = date_create("now -10 minutes", new DateTimeZone("UTC")); $ten_min_from_now = date_create("now +10 minutes", new DateTimeZone("UTC")); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::gatewayRejectedAt()->between($twenty_min_ago, $ten_min_ago)]); $firstCount = $collection->maximumCount(); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::gatewayRejectedAt()->between($ten_min_ago, $ten_min_from_now)]); $secondCount = $collection->maximumCount(); $firstId = $collection->firstItem()->id; Braintree\Configuration::merchantId($old_merchant_id); Braintree\Configuration::publicKey($old_public_key); Braintree\Configuration::privateKey($old_private_key); $this->assertEquals(0, $firstCount); $this->assertEquals(1, $secondCount); $this->assertEquals($transaction->id, $firstId); }