public function test_multipleValueNode_source() { $transaction = Braintree\Transaction::saleNoValidate(['amount' => Braintree\Test\TransactionAmounts::$authorize, 'creditCard' => ['number' => Braintree\Test\CreditCardNumbers::$visa, 'expirationDate' => '05/2012']]); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::source()->is(Braintree\Transaction::API)]); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($transaction->id, $collection->firstItem()->id); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::source()->in([Braintree\Transaction::API, Braintree\Transaction::RECURRING])]); $this->assertEquals(1, $collection->maximumCount()); $this->assertEquals($transaction->id, $collection->firstItem()->id); $collection = Braintree\Transaction::search([Braintree\TransactionSearch::id()->is($transaction->id), Braintree\TransactionSearch::source()->is(Braintree\Transaction::RECURRING)]); $this->assertEquals(0, $collection->maximumCount()); }
public function test_multipleValueNode_source_allowedValues() { $this->setExpectedException('InvalidArgumentException', 'Invalid argument(s) for source: noSuchSource'); $collection = Braintree\Transaction::search(array(Braintree\TransactionSearch::source()->is('noSuchSource'))); }