[wp-trac] [WordPress Trac] #39237: PHPunit coverage reports fail if the is out to the stdout or header

WordPress Trac noreply at wordpress.org
Wed Jul 12 18:20:21 UTC 2017


#39237: PHPunit coverage reports fail if the is out to the stdout or header
--------------------------------------+-----------------------------
 Reporter:  pbearne                   |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Future Release
Component:  Build/Test Tools          |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |     Focuses:
--------------------------------------+-----------------------------

Comment (by pbiron):

 I think the underlying problem here is also preventing me from writing
 unit tests for export.

 I'm trying to have something like the following in a unit test:

 {{{#!php
 ob_start();

 export_wp();

 $wxr = ob_get_flush();
 // $wxr should now contain the exported XML as a string
 }}}

 When `export_wp()` calls `header(...)` an exception is raised because
 "headers already sent".

 Does anyone have a work around that I could use to get the output of an
 export?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39237#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list