public deleteDocument ( |
||
$document | ||
리턴 |
/** * @expectedException \Sokil\Mongo\Exception * @expectedExceptionMessage Delete document error: Some strange error */ public function testDeleteDocument_ErrorDeletingDocument() { $this->collectionMock = $this->getMock('\\MongoCollection', array('remove'), array($this->database->getMongoDB(), 'phpmongo_test_collection')); $this->collectionMock->expects($this->once())->method('remove')->will($this->returnValue(array('ok' => (double) 0, 'err' => 'Some strange error'))); $this->collection = new Collection($this->database, $this->collectionMock); $document = $this->collection->createDocument(array('param' => 'value'))->save(); $this->collection->deleteDocument($document); }
public function testSetId_AsVarchar() { // save document $id = 'im_a_key'; $doc = $this->collection->createDocument(array('a' => 'a')); $doc->setId($id); $doc->save(); // find document $this->assertNotEmpty($this->collection->getDocument($id)); // delete document $this->collection->deleteDocument($doc); }