You are here

function Braintree_SettlementBatchSummaryTest::testGenerate_canBeGroupedByACustomField in Commerce Braintree 7

File

braintree_php/tests/integration/SettlementBatchSummaryTest.php, line 51

Class

Braintree_SettlementBatchSummaryTest

Code

function testGenerate_canBeGroupedByACustomField() {
  $transaction = Braintree_Transaction::saleNoValidate(array(
    'amount' => '100.00',
    'creditCard' => array(
      'number' => '5105105105105100',
      'expirationDate' => '05/12',
    ),
    'customFields' => array(
      'store_me' => 'custom value',
    ),
    'options' => array(
      'submitForSettlement' => true,
    ),
  ));
  Braintree_TestHelper::settle($transaction->id);
  $today = new Datetime();
  $result = Braintree_SettlementBatchSummary::generate(Braintree_TestHelper::nowInEastern(), 'store_me');
  $this
    ->assertTrue($result->success);
  $this
    ->assertTrue(count($result->settlementBatchSummary->records) > 0);
  $this
    ->assertArrayHasKey('store_me', $result->settlementBatchSummary->records[0]);
}