[wp-trac] [WordPress Trac] #42904: Speed up unit tests by disabling password hashing

WordPress Trac noreply at wordpress.org
Thu Dec 14 19:47:19 UTC 2017


#42904: Speed up unit tests by disabling password hashing
------------------------------+-----------------------------
 Reporter:  Frank Klein       |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Build/Test Tools  |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 Whenever the factory creates a new user during a test, it calls
 `wp_insert_user()`. This function calls `wp_hash_password()`, which
 internally uses `PasswordHash::HashPassword()` to create a hash of the
 default password.

 In the context of most unit tests, users do not need hashed passwords.
 Hashing has a performance impact, so the tests should run a bit faster if
 we avoid hashing if we don't need to.

 The attached patch introduces a mock password hasher, that is used by the
 entirety of the tests The exception are a few tests that rely on
 authentication to work properly.

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


More information about the wp-trac mailing list