[wp-trac] [WordPress Trac] #44293: Discrepancy between documentation and implementation of wp_new_user_notification()

WordPress Trac noreply at wordpress.org
Mon Jul 2 08:55:29 UTC 2018


#44293: Discrepancy between documentation and implementation of
wp_new_user_notification()
-------------------------------------------------+-------------------------
 Reporter:  360zen                               |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Users                                |     Version:  4.3
 Severity:  minor                                |  Resolution:
 Keywords:  good-first-bug has-patch dev-        |     Focuses:
  feedback needs-unit-tests needs-refresh        |
-------------------------------------------------+-------------------------
Changes (by swissspidy):

 * keywords:  good-first-bug has-patch has-unit-tests dev-feedback => good-
     first-bug has-patch dev-feedback needs-unit-tests needs-refresh
 * milestone:  Awaiting Review => Future Release


Comment:

 Few notes on the patch:

 * The patch doesn't follow the core coding standards (esp. missing
 spacing), see https://make.wordpress.org/core/handbook/best-practices
 /coding-standards/php/
 * A simple `if ( ! in_array( $notify, array( 'user', 'admin', 'both', ''
 ), true ) ) { return; }` would do the trick. No other check is needed.
 * The unit test doesn't really test the `wp_new_user_notification`
 function. It basically tests whether `in_array` works.
 * We already have tests for `wp_new_user_notification` using a data
 provider (see `tests/phpunit/tests/user.php`). This could be extended with
 a test using `jibrish` as an input.

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


More information about the wp-trac mailing list