There are several methods in CiviCRM that just print their output directly to the buffer and then exit, because they're just sending an HTML snippet or other response for an AJAX call. For example, CRM_Event_Cart_Page_CheckoutAJAX::add_participant_to_cart().
What are best practices for (or existing examples of) unit tests that cover such methods? I could, I suppose, use ob functions to capture the output, but then I'd need an external library to parse and test the HTML. Are there better ways, and are there examples already in place?