/** * @expectedException Apache_Solr_HttpTransportException */ public function testAdd400() { $postData = "does not have to be valid"; $expectedUrl = "http://localhost:8180/solr/update?wt=json"; $expectedTimeout = false; $expectedPostData = $postData; $expectedContentType = "text/xml; charset=UTF-8"; // default for _sendRawPost // set a mock transport $mockTransport = $this->getMockHttpTransportInterface(); // setup expected call and response $mockTransport->expects($this->once())->method('performPostRequest')->with($this->equalTo($expectedUrl), $this->equalTo($postData), $this->equalTo($expectedContentType), $this->equalTo($expectedTimeout))->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get400Response())); // call add $fixture = new Apache_Solr_service(); $fixture->setHttpTransport($mockTransport); $fixture->add($postData); }