[wp-trac] [WordPress Trac] #42065: Introduce `assertNotWPError` in test suite

WordPress Trac noreply at wordpress.org
Mon Oct 2 19:15:14 UTC 2017


#42065: Introduce `assertNotWPError` in test suite
------------------------------+----------------------------
 Reporter:  danielbachhuber   |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Future Release
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+----------------------------
 `WP_Error` often returns useful information about why a function is
 failed.

 However, an assertion like `$this->assertNotInstanceOf( 'WP_Error', $file
 );` isn't helpful to the test runner because it doesn't communicate the
 information conveyed by the `WP_Error` object.

 Currently, someone running the test has to add some `var_dump()` debug (or
 similar) to read the contents of the returned error object.

 It would be helpful to have an `assertNotWPError` assertion that
 communicated the contents of the `WP_Error` object when it actually is
 one.

 Inspired by #42064

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42065>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list