Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #21271, comment 8


Ignore:
Timestamp:
02/19/2014 02:47:19 AM (10 years ago)
Author:
bpetty
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #21271, comment 8

    initial v1  
    33You did suggest a specific global approach though, so let me address that.
    44
    5 * Actually including the admin PHP endpoint files themselves just makes them significantly more complex and not only changes the environment in which they run (something unit tests should avoid when possible), but might not even be possible for certain admin pages, and likely incompatible with numerous plugins which often won't be expecting to be buffered.
     5* Actually including the admin PHP endpoint files themselves just makes them significantly more complex and not only changes the environment in which they run (something unit tests should avoid when possible), but might not even be possible for certain admin pages, and likely incompatible with numerous plugins which often won't be expecting to be buffered (although this obviously only matters for plugins that choose to make use of these types of tests themselves).
    66* This also encourages (as you did yourself) extremely volatile assertions based on content being returned from the output buffer, and this is a specifically discouraged practice when writing unit tests. We need to be writing tests against the functionality of specific individual methods, which is both more reliable, but also more helpful in isolating and identifying broken behaviors.
    77* PHPUnit contains it's own [http://phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.output output buffering functionality] that we don't need to duplicate or interfere with, but even using that isn't encouraged: "A test that emits output will fail in strict mode."