How do I phpunit test a post output process?

In your test, you can create a post, start output buffering with ob_start(), output post content as usual, get output buffer into your variable with ob_end_clean().

Now your can process real post output string and compare it with the expected value.