You are here

function Braintree_TextNodeTest::testEndsWith in Commerce Braintree 7

Same name in this branch
  1. 7 braintree_php/tests/unit/TextNodeTest.php \Braintree_TextNodeTest::testEndsWith()
  2. 7 braintree_php/tests/integration/TextNodeTest.php \Braintree_TextNodeTest::testEndsWith()

File

braintree_php/tests/integration/TextNodeTest.php, line 88

Class

Braintree_TextNodeTest

Code

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