/** * @expectedException \Sokil\Mongo\Exception * @expectedExceptionMessage Batch insert error: Some strange error */ public function testInsertMultiple_ErrorInsertingWithAcknowledgeWrite() { $this->collectionMock = $this->getMock('\\MongoCollection', array('batchInsert'), array($this->database->getMongoDB(), 'phpmongo_test_collection')); $this->collectionMock->expects($this->once())->method('batchInsert')->will($this->returnValue(array('ok' => (double) 0, 'err' => 'Some strange error'))); $collection = new Collection($this->database, $this->collectionMock); // insert multiple $collection->insertMultiple(array(array('a' => 1, 'b' => 2), array('a' => 3, 'b' => 4))); }