function Braintree_SubscriptionSearchTest::testSearch_subscriptionId in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ SubscriptionSearchTest.php, line 141
Class
Code
function testSearch_subscriptionId() {
$creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
$triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
$rand_id = strval(rand());
$subscription_1 = Braintree_Subscription::create(array(
'paymentMethodToken' => $creditCard->token,
'planId' => $triallessPlan['id'],
'id' => 'subscription_123_id_' . $rand_id,
))->subscription;
$subscription_2 = Braintree_Subscription::create(array(
'paymentMethodToken' => $creditCard->token,
'planId' => $triallessPlan['id'],
'id' => 'subscription_23_id_' . $rand_id,
))->subscription;
$subscription_3 = Braintree_Subscription::create(array(
'paymentMethodToken' => $creditCard->token,
'planId' => $triallessPlan['id'],
'id' => 'subscription_3_id_' . $rand_id,
))->subscription;
$collection = Braintree_Subscription::search(array(
Braintree_SubscriptionSearch::id()
->contains("23_id_"),
));
$this
->assertTrue(Braintree_TestHelper::includes($collection, $subscription_1));
$this
->assertTrue(Braintree_TestHelper::includes($collection, $subscription_2));
$this
->assertFalse(Braintree_TestHelper::includes($collection, $subscription_3));
}