You are here

function Braintree_UtilTest::testVerifyKeys_withArrayOfArrays in Commerce Braintree 7

File

braintree_php/tests/unit/UtilTest.php, line 105

Class

Braintree_UtilTest

Code

function testVerifyKeys_withArrayOfArrays() {
  $signature = array(
    array(
      'addOns' => array(
        array(
          'update' => array(
            'amount',
            'existingId',
          ),
        ),
      ),
    ),
  );
  $goodData = array(
    'addOns' => array(
      'update' => array(
        array(
          'amount' => '50.00',
          'existingId' => 'increase_10',
        ),
        array(
          'amount' => '60.00',
          'existingId' => 'increase_20',
        ),
      ),
    ),
  );
  Braintree_Util::verifyKeys($signature, $goodData);
  $badData = array(
    'addOns' => array(
      'update' => array(
        array(
          'invalid' => '50.00',
        ),
      ),
    ),
  );
  $this
    ->setExpectedException('InvalidArgumentException');
  Braintree_Util::verifyKeys($signature, $badData);
}