public function testFromNonce_ReturnsErrorWhenNonceIsConsumed() { $customer = Braintree\Customer::createNoValidate(); $http = new HttpClientApi(Braintree\Configuration::$global); $nonce = $http->nonce_for_new_card(array("credit_card" => array("number" => "4009348888881881", "expirationMonth" => "11", "expirationYear" => "2099"), "customerId" => $customer->id)); Braintree\CreditCard::fromNonce($nonce); $this->setExpectedException('Braintree\\Exception\\NotFound', "consumed"); Braintree\CreditCard::fromNonce($nonce); }