Bitpay\Client\ClientTest::testCreateResponseWithException PHP Method

testCreateResponseWithException() public method

    public function testCreateResponseWithException()
    {
        $item = $this->getMockItem();
        $item->method('getPrice')->will($this->returnValue(1));
        $buyer = $this->getMockBuyer();
        $buyer->method('getAddress')->will($this->returnValue(array()));
        $invoice = $this->getMockInvoice();
        $invoice->method('getItem')->willReturn($item);
        $invoice->method('getBuyer')->willReturn($buyer);
        $invoice->method('setId')->will($this->returnSelf());
        $invoice->method('setUrl')->will($this->returnSelf());
        $invoice->method('setStatus')->will($this->returnSelf());
        $invoice->method('setBtcPrice')->will($this->returnSelf());
        $invoice->method('setPrice')->will($this->returnSelf());
        $invoice->method('setInvoiceTime')->will($this->returnSelf());
        $invoice->method('setExpirationTime')->will($this->returnSelf());
        $invoice->method('setCurrentTime')->will($this->returnSelf());
        $invoice->method('setBtcPaid')->will($this->returnSelf());
        $invoice->method('setRate')->will($this->returnSelf());
        $invoice->method('setExceptionStatus')->will($this->returnSelf());
        $invoice->method('getCurrency')->willReturn($this->getMockCurrency());
        $response = $this->getMockResponse();
        $response->method('getBody')->will($this->returnValue('{"error":"Some error message"}'));
        $adapter = $this->getMockAdapter();
        $adapter->method('sendRequest')->willReturn($response);
        $this->client->setAdapter($adapter);
        $this->client->createInvoice($invoice);
    }