Add publish method for documents with test