private function createAccount() { $this->accounts[] = $account = new Account(); $account->setName('test' . time()); $this->client->createAccount($account); return $account; }
public function testCreateAccount() { $account = new Account(); $response = $this->getMock(ResponseInterface::class); $this->mapper->expects($this->any())->method('fromAccount')->with($account)->willReturn(['key' => 'value']); $this->http->expects($this->once())->method('post')->with('/v2/accounts', ['key' => 'value', 'foo' => 'bar'])->willReturn($response); $this->mapper->expects($this->once())->method('toAccount')->with($response, $account); $this->client->createAccount($account, ['foo' => 'bar']); }