public function testCreateBuy() { $account = Account::reference('ACCOUNT_ID'); $buy = new Buy(); $response = $this->getMock(ResponseInterface::class); $this->mapper->expects($this->any())->method('fromBuy')->with($buy)->willReturn(['key' => 'value']); $this->http->expects($this->once())->method('post')->with('/v2/accounts/ACCOUNT_ID/buys', ['key' => 'value', 'foo' => 'bar'])->willReturn($response); $this->mapper->expects($this->once())->method('toBuy')->with($response, $buy); $this->client->createAccountBuy($account, $buy, ['foo' => 'bar']); }