function testAll_withNoPlans_returnsEmptyArray() { testMerchantConfig(); $plans = Braintree_Plan::all(); $this->assertEquals($plans, array()); integrationMerchantConfig(); }
require_once "Braintree/PaymentInstrumentType.php"; function integrationMerchantConfig() { Braintree_Configuration::environment('development'); Braintree_Configuration::merchantId('integration_merchant_id'); Braintree_Configuration::publicKey('integration_public_key'); Braintree_Configuration::privateKey('integration_private_key'); } function testMerchantConfig() { Braintree_Configuration::environment('development'); Braintree_Configuration::merchantId('test_merchant_id'); Braintree_Configuration::publicKey('test_public_key'); Braintree_Configuration::privateKey('test_private_key'); } integrationMerchantConfig(); date_default_timezone_set("UTC"); class Braintree_TestHelper { public static function defaultMerchantAccountId() { return 'sandbox_credit_card'; } public static function nonDefaultMerchantAccountId() { return 'sandbox_credit_card_non_default'; } public static function nonDefaultSubMerchantAccountId() { return 'sandbox_sub_merchant_account'; }
function setup() { integrationMerchantConfig(); }
function testDelete_worksWithCreditCards() { $paymentMethodToken = 'CREDIT_CARD_TOKEN-' . strval(rand()); $customer = Braintree_Customer::createNoValidate(); $creditCardResult = Braintree_CreditCard::create(array('customerId' => $customer->id, 'number' => '5105105105105100', 'expirationDate' => '05/2011', 'token' => $paymentMethodToken)); $this->assertTrue($creditCardResult->success); Braintree_PaymentMethod::delete($paymentMethodToken); $this->setExpectedException('Braintree_Exception_NotFound'); Braintree_PaymentMethod::find($paymentMethodToken); integrationMerchantConfig(); }
function teardown() { // Fix overwritten configuration in wrong key check: integrationMerchantConfig(); }