/** * @expectedException \Sokil\Mongo\Exception * @expectedExceptionMessage Error setting write concern */ public function testSetWriteConcern_Error() { $mongoCollectionMock = $this->getMock('\\MongoCollection', array('setWriteConcern'), array($this->database->getMongoDB(), 'test')); $mongoCollectionMock->expects($this->once())->method('setWriteConcern')->will($this->returnValue(false)); $collection = new Collection($this->database, $mongoCollectionMock); $collection->setWriteConcern(1); }