public function testCreateWithdrawal() { $account = Account::reference('ACCOUNT_ID'); $withdrawal = new Withdrawal(); $response = $this->getMock(ResponseInterface::class); $this->mapper->expects($this->any())->method('fromWithdrawal')->with($withdrawal)->willReturn(['key' => 'value']); $this->http->expects($this->once())->method('post')->with('/v2/accounts/ACCOUNT_ID/withdrawals', ['key' => 'value', 'foo' => 'bar'])->willReturn($response); $this->mapper->expects($this->once())->method('toWithdrawal')->with($response, $withdrawal); $this->client->createAccountWithdrawal($account, $withdrawal, ['foo' => 'bar']); }