/** * @expectedException \CvoTechnologies\Twitter\Webservice\Exception\UnknownErrorException */ public function testStatusUpdateDuplicate() { $client = $this->getMockBuilder('Cake\\Network\\Http\\Client')->setMethods(['post'])->getMock(); $client->expects($this->once())->method('post')->with('/1.1/statuses/update.json', ['status' => 'Test123'])->willReturn(new Response(['HTTP/1.1 403 Forbidden'], json_encode(['errors' => [['message' => 'Status is a duplicate.']]]))); $this->webservice->driver()->client($client); $query = new Query($this->webservice, new Endpoint()); $query->create(); $query->set(['text' => 'Test123']); $resource = $this->webservice->execute($query); $this->assertInstanceOf('Muffin\\Webservice\\Model\\Resource', $resource); $this->assertEquals($resource->text, 'Test123'); }