You are here

function Braintree_TransactionAdvancedSearchTest::test_multipleValueNode_merchantAccountId in Commerce Braintree 7

File

braintree_php/tests/integration/TransactionAdvancedSearchTest.php, line 361

Class

Braintree_TransactionAdvancedSearchTest

Code

function test_multipleValueNode_merchantAccountId() {
  $transaction = Braintree_Transaction::saleNoValidate(array(
    'amount' => Braintree_Test_TransactionAmounts::$authorize,
    'creditCard' => array(
      'number' => Braintree_Test_CreditCardNumbers::$visa,
      'expirationDate' => '05/2012',
    ),
  ));
  $collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::id()
      ->is($transaction->id),
    Braintree_TransactionSearch::merchantAccountId()
      ->is($transaction->merchantAccountId),
  ));
  $this
    ->assertEquals(1, $collection
    ->maximumCount());
  $this
    ->assertEquals($transaction->id, $collection
    ->firstItem()->id);
  $collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::id()
      ->is($transaction->id),
    Braintree_TransactionSearch::merchantAccountId()
      ->in(array(
      $transaction->merchantAccountId,
      "bogus_merchant_account_id",
    )),
  ));
  $this
    ->assertEquals(1, $collection
    ->maximumCount());
  $this
    ->assertEquals($transaction->id, $collection
    ->firstItem()->id);
  $collection = Braintree_Transaction::search(array(
    Braintree_TransactionSearch::id()
      ->is($transaction->id),
    Braintree_TransactionSearch::merchantAccountId()
      ->is("bogus_merchant_account_id"),
  ));
  $this
    ->assertEquals(0, $collection
    ->maximumCount());
}