/** * @expectedException \Sokil\Mongo\Exception * @expectedExceptionMessage Update error */ public function testUpdateAll_ErrorWithUnacknowledgedWriteConcern() { // mock mongo's collection $mongoCollectionMock = $this->getMock('\\MongoCollection', array('update'), array($this->database->getMongoDB(), 'phpmongo_test_collection')); $mongoCollectionMock->expects($this->once())->method('update')->with($this->isType('array'), $this->isType('array'), $this->arrayHasKey('multiple'))->will($this->returnValue(false)); // create collection with mocked original mongo collection $this->collection = new Collection($this->database, $mongoCollectionMock); $this->collection->setUnacknowledgedWriteConcern(); $this->collection->updateAll(new Operator()); }