You are here

function Braintree_TransparentRedirectTest::testParseAndValidateQueryString_throwsAuthenticationErrorIfBadCredentials in Commerce Braintree 7

File

braintree_php/tests/integration/TransparentRedirectTest.php, line 36

Class

Braintree_TransparentRedirectTest

Code

function testParseAndValidateQueryString_throwsAuthenticationErrorIfBadCredentials() {
  Braintree_TestHelper::suppressDeprecationWarnings();
  $privateKey = Braintree_Configuration::privateKey();
  Braintree_Configuration::privateKey('incorrect');
  try {
    $trData = Braintree_TransparentRedirect::createCustomerData(array(
      "redirectUrl" => "http://www.example.com",
    ));
    $queryString = Braintree_TestHelper::submitTrRequest(Braintree_Customer::createCustomerUrl(), array(), $trData);
    $this
      ->setExpectedException('Braintree_Exception_Authentication');
    Braintree_Customer::createFromTransparentRedirect($queryString);
  } catch (Exception $e) {
  }
  $privateKey = Braintree_Configuration::privateKey($privateKey);
  if (isset($e)) {
    throw $e;
  }
}