public function testUpdate_handleErrors()
 {
     $customer = Braintree\Customer::createNoValidate();
     $firstToken = 'FIRST_PAYPALToken-' . strval(rand());
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $firstNonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $firstToken]]);
     $firstPaypalAccount = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $firstNonce]);
     $this->assertTrue($firstPaypalAccount->success);
     $secondToken = 'SECOND_PAYPALToken-' . strval(rand());
     $http = new HttpClientApi(Braintree\Configuration::$global);
     $secondNonce = $http->nonceForPayPalAccount(['paypal_account' => ['consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $secondToken]]);
     $secondPaypalAccount = Braintree\PaymentMethod::create(['customerId' => $customer->id, 'paymentMethodNonce' => $secondNonce]);
     $this->assertTrue($secondPaypalAccount->success);
     $updateResult = Braintree\PayPalAccount::update($firstToken, ['token' => $secondToken]);
     $this->assertFalse($updateResult->success);
     $errors = $updateResult->errors->forKey('paypalAccount')->errors;
     $this->assertEquals(Braintree\Error\Codes::PAYPAL_ACCOUNT_TOKEN_IS_IN_USE, $errors[0]->code);
 }