In addition to checking and updating the post status when postmeta is updated, also perform the check when postmeta is added. This fixes a bug whereby posts that are created using Gutenberg and saved via the REST API don't trigger the postmeta update hook, since they are being added for the first time.
Adds a unit test to validate the behavior of the add and update postmeta hooks.
Fixes a number of notices relating to undefined keys in contexts where the global post object may be empty.
Modifies the logic for the transition post hook to be more inclusive and not only run on future post status transitions, but all post status transitions where the post stati are different and the new status is 'publish'.