function testGatewayFind() { $paymentMethodToken = 'PAYPALToken-' . strval(rand()); $customer = Braintree_Customer::createNoValidate(); $http = new Braintree_HttpClientApi(Braintree_Configuration::$global); $nonce = $http->nonceForPayPalAccount(array('paypal_account' => array('consent_code' => 'PAYPAL_CONSENT_CODE', 'token' => $paymentMethodToken))); Braintree_PaymentMethod::create(array('customerId' => $customer->id, 'paymentMethodNonce' => $nonce)); $gateway = new Braintree_Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key')); $foundPayPalAccount = $gateway->paypalAccount()->find($paymentMethodToken); $this->assertSame('*****@*****.**', $foundPayPalAccount->email); $this->assertSame($paymentMethodToken, $foundPayPalAccount->token); $this->assertNotNull($foundPayPalAccount->imageUrl); }