You are here

function Braintree_SubscriptionSearchTest::testSearch_planIdIs in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionSearchTest

Code

function testSearch_planIdIs() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
  $trialPlan = Braintree_SubscriptionTestHelper::trialPlan();
  $trialSubscription = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $trialPlan['id'],
    'price' => '1',
  ))->subscription;
  $triallessSubscription = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $triallessPlan['id'],
    'price' => '1',
  ))->subscription;
  $collection = Braintree_Subscription::search(array(
    Braintree_SubscriptionSearch::planId()
      ->is('integration_trial_plan'),
    Braintree_SubscriptionSearch::price()
      ->is('1'),
  ));
  $this
    ->assertTrue(Braintree_TestHelper::includes($collection, $trialSubscription));
  $this
    ->assertFalse(Braintree_TestHelper::includes($collection, $triallessSubscription));
}