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
);
}
}