Sokil\Mongo\DocumentTest::testSave_UpdateError PHP Method

testSave_UpdateError() public method

    public function testSave_UpdateError()
    {
        $mongoCollectionMock = $this->getMock('\\MongoCollection', array('update'), array($this->collection->getDatabase()->getMongoDb(), 'phpmongo_test_collection'));
        $mongoCollectionMock->expects($this->once())->method('update')->will($this->returnValue(array('ok' => (double) 0, 'err' => 'some_strange_error', 'errmsg' => 'Some strange error')));
        $collection = new Collection($this->collection->getDatabase(), $mongoCollectionMock);
        // create document
        $document = $collection->createDocument(array('p' => 'v'))->save();
        // update document with error
        $document->set('p', 'v1')->save();
    }
DocumentTest