function Braintree_MultipleValueNodeTest::testIn_singleValue in Commerce Braintree 7
File
- braintree_php/
tests/ integration/ MultipleValueNodeTest.php, line 7
Class
Code
function testIn_singleValue() {
$creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
$triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
$activeSubscription = Braintree_Subscription::create(array(
'paymentMethodToken' => $creditCard->token,
'planId' => $triallessPlan['id'],
'price' => '3',
))->subscription;
$canceledSubscription = Braintree_Subscription::create(array(
'paymentMethodToken' => $creditCard->token,
'planId' => $triallessPlan['id'],
'price' => '3',
))->subscription;
Braintree_Subscription::cancel($canceledSubscription->id);
$collection = Braintree_Subscription::search(array(
Braintree_SubscriptionSearch::status()
->in(array(
Braintree_Subscription::ACTIVE,
)),
Braintree_SubscriptionSearch::price()
->is('3'),
));
foreach ($collection as $item) {
$this
->assertEquals(Braintree_Subscription::ACTIVE, $item->status);
}
$this
->assertTrue(Braintree_TestHelper::includes($collection, $activeSubscription));
$this
->assertFalse(Braintree_TestHelper::includes($collection, $canceledSubscription));
}