Snapshotting of global state, factored out of PHPUnit into a stand-alone component