setField('id', $id);
$document->setField('title', "Item $id");
return $document;
}
public function testAddDocument() {
$service = $this->getMockService();
$sent = $service->addDocument($this->getMockDocument('A'), false);
$this->assertEquals(
'AItem A',
$sent
);
$sent = $service->addDocument($this->getMockDocument('B'), true);
$this->assertEquals(
'BItem B',
$sent
);
}
public function testAddDocuments() {
$service = $this->getMockService();
$sent = $service->addDocuments(array(
$this->getMockDocument('C'),
$this->getMockDocument('D')
), false);
$this->assertEquals(
'CItem CDItem D',
$sent
);
$sent = $service->addDocuments(array(
$this->getMockDocument('E'),
$this->getMockDocument('F')
), true);
$this->assertEquals(
'EItem EFItem F',
$sent
);
}
}
class Solr4ServiceTest_RecordingService extends Solr4Service_Core {
protected function _sendRawPost($url, $rawPost, $timeout = FALSE, $contentType = 'text/xml; charset=UTF-8') {
return $rawPost;
}
protected function _sendRawGet($url, $timeout = FALSE) {
return $url;
}
}