[wp-trac] [WordPress Trac] #30354: get_posts_by_author_sql doesn't also return prefixed where is asked to

WordPress Trac noreply at wordpress.org
Sat Mar 7 01:01:01 UTC 2015


#30354: get_posts_by_author_sql doesn't also return prefixed where is asked to
--------------------------------------+-----------------------------
 Reporter:  pbearne                   |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  4.2
Component:  Query                     |     Version:  3.0
 Severity:  normal                    |  Resolution:
 Keywords:  has-unit-tests has-patch  |     Focuses:  administration
--------------------------------------+-----------------------------
Changes (by boonebgorges):

 * keywords:  has-unit-tests has-patch 4.2-early => has-unit-tests has-patch


Comment:

 pbearne - Thanks for the patches and for the tests. The logic looks good -
 I'm going to take this opportunity to simplify the function more generally
 just a bit.

 As for the tests, your tests are strictly correct, but writing unit tests
 of this level of specificity for SQL strings is not ideal. If one little
 thing changes in the SQL generation - like, one extra space character is
 inserted - the tests will all need to be rewritten. I'm going to change
 the tests to be more focused, and then we'll rely on the
 `count_user_posts()` and `wp_list_authors()` tests (both of which
 functions depend on `get_posts_by_author_sql()`) to check that the overall
 syntax is correct.

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


More information about the wp-trac mailing list