You are here

function Braintree_SubscriptionSearchTest::testSearch_price in Commerce Braintree 7

File

braintree_php/tests/integration/SubscriptionSearchTest.php, line 231

Class

Braintree_SubscriptionSearchTest

Code

function testSearch_price() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
  $subscription_850 = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $triallessPlan['id'],
    'price' => '8.50',
  ))->subscription;
  $subscription_851 = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $triallessPlan['id'],
    'price' => '8.51',
  ))->subscription;
  $subscription_852 = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $triallessPlan['id'],
    'price' => '8.52',
  ))->subscription;
  $collection = Braintree_Subscription::search(array(
    Braintree_SubscriptionSearch::price()
      ->between('8.51', '8.52'),
  ));
  $this
    ->assertTrue(Braintree_TestHelper::includes($collection, $subscription_851));
  $this
    ->assertTrue(Braintree_TestHelper::includes($collection, $subscription_852));
  $this
    ->assertFalse(Braintree_TestHelper::includes($collection, $subscription_850));
}