Commit Graph

1051 Commits

Author SHA1 Message Date
Boone Gorges
8235387ee4 Clean up uploaded file after test_media_handle_upload_sets_post_excerpt().
Props McGuive7.
Fixes #32534.

git-svn-id: https://develop.svn.wordpress.org/trunk@32794 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 12:37:30 +00:00
Scott Taylor
1e8fb99ebd Improve the consistency of punctuation matching in wptexturize().
Adds unit tests.

Props miqrogroove.
Fixes #31886.


git-svn-id: https://develop.svn.wordpress.org/trunk@32789 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:49:45 +00:00
Scott Taylor
40bb9aa3d9 Allow 'Cockney' filter to be translated.
Updates unit test.

Props miqrogroove.
Fixes #31953.


git-svn-id: https://develop.svn.wordpress.org/trunk@32788 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:45:49 +00:00
Scott Taylor
7dd8a1364a In the youtube_embed_url embed handler, make embed a non-capturing group that alternately matches for v - YouTube supports both URL paths.
Add unit test cases.

Props dmchale for some patch work.
Fixes #32161.


git-svn-id: https://develop.svn.wordpress.org/trunk@32787 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:34:06 +00:00
Scott Taylor
2860548f5b Set $_SERVER['REQUEST_METHOD'] for unit tests.
Props johnbillion.
Fixes #32636.


git-svn-id: https://develop.svn.wordpress.org/trunk@32785 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:03:25 +00:00
Jeremy Felt
7819ac5d16 Introduce get_main_network_id()
Expand on the logic previously available as part of `is_main_network()` and provide a way to obtain the ID of the main network. Most useful in multi-network configurations.

Props @johnjamesjacoby for the initial patch.
Fixes #30294.


git-svn-id: https://develop.svn.wordpress.org/trunk@32775 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-14 21:44:45 +00:00
Aaron Jorbin
7988f78e44 Improve dbDelta unit tests
Add new tests for more parts of dbDelta.  This was cleaned up and prepared for commit at #wcphilly contributor day.

Props jdgrimes, tryon, jtsternberg, ebinnion, JPry, avnarun, kevkoeh, jorbin, salcode.
Fixes #29020.



git-svn-id: https://develop.svn.wordpress.org/trunk@32770 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-14 19:22:20 +00:00
Scott Taylor
9c42e158bc $status shouldn't be loosely compared to true in wp_xmlrpc_server::wp_deleteComment().
`$initial` shouldn't be loosely compared to `true` in `get_calendar()`.
`current_user_can()` shouldn't be loosely compared to `false` in `kses_init()`
`$get_all` shouldn't be loosely compared to `true` in `get_blog_details()`.
`is_array()` and `in_array()` shouldn't be loosely compared in `wpmu_validate_user_signup()`.
`$result` should by strictly compared in `check_ajax_referer()`.
`wp_verify_nonce()` should by strictly compared in `_show_post_preview()`.
`is_user_logged_in()` should not be loosly compared against `false` in `wp-signup.php`.

See #32444.


git-svn-id: https://develop.svn.wordpress.org/trunk@32733 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-12 17:47:16 +00:00
Boone Gorges
dba2b6a9c0 Introduce class argument to wp_dropdown_pages().
This new argument allows devs to specify the 'class' attribute of the select
element.

Props ramiy, voldemortensen.
Fixes #30082.

git-svn-id: https://develop.svn.wordpress.org/trunk@32727 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-12 13:04:04 +00:00
Boone Gorges
c04185a1f2 Avoid returning duplicate matches when using a meta query in WP_User_Query.
A meta_query containing an `OR` relation can result in the same record matching
multiple clauses, leading to duplicate results. The previous prevention against
duplicates [18178] #17582 became unreliable in 4.1 when `WP_Meta_Query`
introduced support for nested clauses. The current changeset adds a new method
`WP_Meta_Query::has_or_relation()` for checking whether an `OR` relation
appears anywhere in the query, and uses the new method in `WP_User_Query` to
enforce distinct results as necessary.

Props maxxsnake.
Fixes #32592.

git-svn-id: https://develop.svn.wordpress.org/trunk@32713 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-09 17:41:35 +00:00
Dion Hulse
306d8b6a1e WP_HTTP: ensure that the temporary file is created within the temporary directly when stream is specified without a filename parameter.
Fixes #32549


git-svn-id: https://develop.svn.wordpress.org/trunk@32712 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-09 03:54:49 +00:00
Boone Gorges
036c33caaa Filter out empty object_types in register_taxonomy_for_object_type().
This prevents weird edge bugs when registering an existing taxonomy with an
object type when the taxonomy was previously associated with no object types.

Fixes #32590.

git-svn-id: https://develop.svn.wordpress.org/trunk@32709 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-08 19:44:32 +00:00
Dominik Schilling (ocean90)
b3660e2731 Parse request: Quote regular expression characters in home path.
Adds unit tests.

props akirk.
fixes #30438.

git-svn-id: https://develop.svn.wordpress.org/trunk@32708 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-08 13:28:44 +00:00
Boone Gorges
9747d9f611 In wp_notify_moderator(), don't throw notice when comment belongs to a post with no author.
Props Oxymoron.
Fixes #32566.

git-svn-id: https://develop.svn.wordpress.org/trunk@32692 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-04 17:28:07 +00:00
Boone Gorges
6e8fd2509e Introduce 'has_published_posts' parameter for WP_User_Query.
This allows user query results to be limited to those users who have published
posts in at least one of the specified post types.

Props joehoyle, boonebgorges.
Fixes #32250.

git-svn-id: https://develop.svn.wordpress.org/trunk@32683 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-02 13:29:44 +00:00
Boone Gorges
a59ebc0ed4 Term unit test factory class should override create_and_get() method.
The override is necessary because the `get_term()` call, which fetches the
term object, needs the `'taxonomy'` argument passed to the factory method.

Props dlh.
Fixes #32536.

git-svn-id: https://develop.svn.wordpress.org/trunk@32659 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-30 13:03:07 +00:00
Weston Ruter
cc19680774 Add JS templates for Customizer Panels and Sections.
This extends the approach taken for Customizer Controls in #29572.

Props celloexpressions, westonruter, ocean90.
See #30737.


git-svn-id: https://develop.svn.wordpress.org/trunk@32658 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-30 00:02:13 +00:00
Boone Gorges
bb8999fb0e When parsing what appears to be a date archive request, check for a post with a clashing permalink before resolving to the archive.
A URL like `example.com/2015/05/15/` generally resolves to the May 15, 2015 date
archive. But in certain cases, it could also be the permalink of a post with
the slug `'2015'`. When a conflict of this sort is detected, resolve to the post
instead of the archive.

URL conflicts of this sort should no longer occur for new posts; see [32647].

Props valendesigns, boonebgorges, Denis-de-Bernardy.
Fixes #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32648 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 13:09:26 +00:00
Boone Gorges
683ae35c33 Disallow post slugs that will result in permalinks that conflict with date archive URLs.
On certain permalink structures, a numeric post slug will result in a post
permalink that conflicts with a date archive URL. For example, with permastruct
`/%year%/%monthnum%/%postname%/`, a post published in May 2015 with slug
`'15'` will result in a URL (`/2015/05/15/`) that conflicts with the archive
for May 15, 2015.

To avoid this problem, `wp_unique_post_slug()` rejects a requested slug when it
would generate a conflict of this type. Thus, in our example, `'15'` would
become `'15-2'`.

Props valendesigns, boonebgorges, Denis-de-Bernardy, loushou.
See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32647 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 12:52:17 +00:00
Boone Gorges
25afc4b16a is_email_address_unsafe() tests should only be run on multisite.
See [32638].

git-svn-id: https://develop.svn.wordpress.org/trunk@32646 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-29 12:37:51 +00:00
Boone Gorges
8dced310b1 Improve tests for is_email_address_unsafe().
* Move to a separate file for better organization and method names.
* Use a `dataProvider` when appropriate, for better readability.
* Add a test for splitting the banned domain list on line breaks.

See #20459, #21730.

git-svn-id: https://develop.svn.wordpress.org/trunk@32638 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 16:05:30 +00:00
Jeremy Felt
c12e7d763c Use a dataProvider for network option sanitization tests.
Cleans up tests for sanitization of `illegal_names`, `illegal_email_domains`, and `banned_email_domains` network options.

Fixes #32517.


git-svn-id: https://develop.svn.wordpress.org/trunk@32634 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 06:37:44 +00:00
Andrew Nacin
7aef782aa8 Add unit test asserting that serializable objects will never pass is_serialized(). see #17375.
git-svn-id: https://develop.svn.wordpress.org/trunk@32631 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-28 05:22:14 +00:00
Jeremy Felt
9560fbdd77 Provide all site flag data in objects returned by get_blogs_of_user()
Previously, `archived`, `spam`, and `deleted` properties were forced to `0` when returned by `get_blogs_of_user()`. This was originally introduced in [21794] as a way to prevent notices when properties were expected.

Instead, we can properly fill these properties with those retrieved from `get_blog_details()`.

Props realloc.
Fixes #32281.


git-svn-id: https://develop.svn.wordpress.org/trunk@32626 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-27 21:22:09 +00:00
Boone Gorges
d10ec28b01 Improve unit tests for wp_unique_post_slug().
See #5305.

git-svn-id: https://develop.svn.wordpress.org/trunk@32604 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-26 18:07:17 +00:00
westonruter
6d34b6e075 Add support for WP_Widget::get_settings() returning ArrayIterator/ArrayObject instances.
Plugins can use `pre_option_widget_{$id_base}` filters to return `ArrayIterator`/`ArrayObject` instances instead of primitive arrays. This makes possible for widget instance data to be drawn from somewhere else than `wp_options`, such as a custom post type.

Add unit tests for widgets.

Fixes #32474.



git-svn-id: https://develop.svn.wordpress.org/trunk@32602 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-26 16:50:03 +00:00
Boone Gorges
94a9896b05 Introduced $field argument to get_term_link().
This new argument allows developers to specify which term field should be
matched by the value of the `$term` parameter (in particular, 'name' and
'term_taxonomy_id' are now supported).

Props sudar, mordauk.
Fixes #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@32553 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-23 18:28:22 +00:00
Boone Gorges
6cb6f3916a Unit tests for get_term_link().
See #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@32552 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-23 18:12:27 +00:00
Boone Gorges
f0d6031d9b Streamline support for multiple post types in get_posts_by_author_sql().
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document.
* Add changelog entries to all calling functions.

Props DrewAPicture.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32524 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 19:48:19 +00:00
Boone Gorges
e656053bce Support multiple post types in count_user_posts() and other functions that use get_posts_by_author_sql().
Props nikonratm.
Fixes #32243.

git-svn-id: https://develop.svn.wordpress.org/trunk@32523 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-21 18:42:49 +00:00
Boone Gorges
15a0c621ea Add tests for check_comment().
Props CalEvans, rachelbaker.
Fixes #31108.

git-svn-id: https://develop.svn.wordpress.org/trunk@32519 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-20 19:08:07 +00:00
John Blackbourn
064bed9792 Use the available user and blog factories in the Tests_Multisite_Option::test_with_another_site() test.
Fixes #32404


git-svn-id: https://develop.svn.wordpress.org/trunk@32518 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-20 19:02:42 +00:00
Jeremy Felt
6063b2c0f9 Use WP_TESTS_DOMAIN in test_get_blogaddress_by_id_with_valid_id()
A hard coded `example.org` would break the test if a custom `WP_TESTS_DOMAIN` was specified. We should defer to the configured default.

Fixes #32026.


git-svn-id: https://develop.svn.wordpress.org/trunk@32512 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-19 05:45:31 +00:00
Sergey Biryukov
09bd58b4c9 In comment_form(), ensure that filtered arguments contain all required default values.
props boonebgorges.
fixes #32312 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@32511 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-19 01:03:39 +00:00
Boone Gorges
0027615ed1 Improve unit tests for wp_unique_term_slug().
See #20783.

git-svn-id: https://develop.svn.wordpress.org/trunk@32507 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-15 20:37:51 +00:00
Boone Gorges
1a8bd3bf07 In category dropdown, 'selected' should match against 'value_field'.
Props tlexcellent.
Fixes #32330.

git-svn-id: https://develop.svn.wordpress.org/trunk@32484 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-11 13:10:19 +00:00
John Blackbourn
39639c79da Add a return value to wp_register_script() and wp_register_style() which matches the return value of WP_Dependencies::add().
Props katzwebdesign, pareshradadiya, DrewAPicture.

Fixes #31126


git-svn-id: https://develop.svn.wordpress.org/trunk@32483 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-10 19:56:15 +00:00
Boone Gorges
637bedeece Use table prefix for comment__in and comment__not_in SQL clauses of WP_Comment_Query.
The prefix prevents ambiguity when joining against other tables.

Props willgladstone.
Fixes #32081.

git-svn-id: https://develop.svn.wordpress.org/trunk@32461 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-08 19:44:06 +00:00
Gary Pendergast
ed53ad2c53 WPDB: When sanity checking query character sets, there's no need to check queries that don't return user data.
See #32104.



git-svn-id: https://develop.svn.wordpress.org/trunk@32374 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 06:04:50 +00:00
Gary Pendergast
923c6c981b WPDB: Allow queries to reference tables in the dbname.tablename format, and allow table names to contain any valid character, rather than just ASCII.
Props pento, willstedt for the initial patch.

See #32090.



git-svn-id: https://develop.svn.wordpress.org/trunk@32368 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 05:00:39 +00:00
Gary Pendergast
2ce97b2984 WPDB: When checking that a string can be sent to MySQL, we shouldn't use mb_convert_encoding(), as it behaves differently to MySQL's character encoding conversion.
Props mdawaffe, pento, nbachiyski, jorbin, johnjamesjacoby, jeremyfelt.

See #32165.



git-svn-id: https://develop.svn.wordpress.org/trunk@32364 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-06 02:59:50 +00:00
Boone Gorges
35db6d722b In paginate_links(), improve handling of custom pagination query vars.
Custom pagination query vars, as provided in the 'base' parameter, must be
detected in the current page URL and removed before generating fresh pagination
links. The logic introduced in this changeset ensures that these custom
query vars are properly detected in cases where the 'format' param contains
a `#`.

This is a follow-up to [31203] #30831.

Fixes #31939.

git-svn-id: https://develop.svn.wordpress.org/trunk@32359 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 21:58:23 +00:00
Boone Gorges
70f530e238 youtube.com oEmbed test should always expect HTTPS.
YouTube recently changed its oEmbed endpoint so that the iframe markup always
contains an HTTPS URL, regardless of the scheme of the video URL originally
requested. This changeset fixes the corresponding unit test.

Fixes #32260.

git-svn-id: https://develop.svn.wordpress.org/trunk@32358 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 21:30:57 +00:00
Boone Gorges
ba712c6789 Unit tests for get_page_children().
Props santagada, boonebgorges.
See #10852.

git-svn-id: https://develop.svn.wordpress.org/trunk@32354 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 19:36:46 +00:00
Boone Gorges
1efe303ebf Improve sanitization of 'name' param in get_terms().
Values of 'name' that contain db-encoded character on insert - like an
ampersand, which is HTML-encoded in the database - will only match if they go
through the same `sanitize_term_field()` routine.

Fixes #32248.

git-svn-id: https://develop.svn.wordpress.org/trunk@32353 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 11:13:51 +00:00
Boone Gorges
93a4bf15e4 Attachment URLs should only be forced to SSL on the front end.
Detecting SSL status on the Dashboard introduces problems when writing content
that is saved to the database and then displayed on the front end, where SSL
may be optional (or impossible, due to self-signed certificates). The new
approach parallels the logic in `get_home_url()` for forcing HTTPS.

See [31614] #15928 for background.

Fixes #32112 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@32342 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-04 13:09:14 +00:00
Boone Gorges
e5e467a41b Allow metadata to be deleted when meta_value matches 0 or '0'.
In `delete_metadata()`, be stricter about when to ignore a falsey value of
`$meta_value`.

For backward compatibility, an empty string for `$meta_value` is equivalent to
`null` or `false`.

Props sc0ttkclark.
Fixes #32224.

git-svn-id: https://develop.svn.wordpress.org/trunk@32331 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-01 16:37:35 +00:00
Gary Pendergast
0152b8f49b In [32299], we should be using mb_strlen() for our string size checks.
git-svn-id: https://develop.svn.wordpress.org/trunk@32306 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:41:48 +00:00
Gary Pendergast
45b0abbef1 WPDB: Sanity check that any strings being stored in the DB are not too long to store correctly.
git-svn-id: https://develop.svn.wordpress.org/trunk@32299 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-27 14:02:45 +00:00
Boone Gorges
c3ea088948 When priming the cache for taxonomy term nav items, don't fetch term descendants.
Descending the term tree causes unnecessary database queries when priming the
cache for a term with many descendants.

Fixes #31724.

git-svn-id: https://develop.svn.wordpress.org/trunk@32294 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 18:57:07 +00:00
Boone Gorges
7add279793 Allow rewrite endpoints to be registered without also registering query vars.
Passing `false` to `add_rewrite_endpoint()` will now allow you to take
advantage of the rewrite API without thereby modifying the way that WP sets up
the main query from the request URI.

This new functionality allows developers to work around certain edge-case bugs,
such as when a proper endpoint request (such as `/test/1/`) would short-
circuit `is_home()` calculation when a static front page is set.

Props mordauk, boonebgorges.
Fixes #25143.

git-svn-id: https://develop.svn.wordpress.org/trunk@32293 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 16:37:12 +00:00
Boone Gorges
000f4f98b4 In wp_list_categories(), 'All' link should point to post type archive if taxonomy is not registered for 'post' or 'page'.
Instead, we point to the post type archive of the first registered
object_type that supports archives.

Props stevegrunwell, hrishiv90, boonebgorges.
Fixes #21881.

git-svn-id: https://develop.svn.wordpress.org/trunk@32292 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-24 14:56:37 +00:00
Gary Pendergast
cc8a9824c5 WPDB: When sanity checking a string by sending it to MySQL for conversion checks, the incorrect data structure was being returned from wpdb::strip_invalid_text(), causing all write queries to fail for some character sets when the query contained non-ASCII characters.
See #32051.



git-svn-id: https://develop.svn.wordpress.org/trunk@32261 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-22 15:01:25 +00:00
Gary Pendergast
afe046a84c WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if the query is entirely ASCII characters.
See #32029.



git-svn-id: https://develop.svn.wordpress.org/trunk@32233 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:23:44 +00:00
Gary Pendergast
0fe5a64e56 WPDB: When deciding if a query needs extra sanity checking based on collation, we can quickly return if it's a query that will never return user data.
Fixes #32029.



git-svn-id: https://develop.svn.wordpress.org/trunk@32232 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-21 05:10:11 +00:00
Boone Gorges
80ca5b2b53 In term-splitting unit tests, correct incorrect wording in an inline comment.
Props dlh.
Fixes #32014.

git-svn-id: https://develop.svn.wordpress.org/trunk@32208 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 15:17:24 +00:00
Boone Gorges
1a38d95e83 Ensure that 'who' param is respected when generating meta_query in WP_User_Query.
Since [31669], the 'who' param had been parsed after meta_query was generated,
so that 'who' was effectively ignored.

Props imath.
Fixes #32019.

git-svn-id: https://develop.svn.wordpress.org/trunk@32207 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 15:15:14 +00:00
Gary Pendergast
c9774eac69 Unit Tests: The get_smilies_combinations test was failing when the tests were run with a non-default domain.
Props netweb.

Fixes #32025.



git-svn-id: https://develop.svn.wordpress.org/trunk@32178 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 10:10:53 +00:00
Gary Pendergast
8453d41a44 Fix the unit test added in [32173] to run correctly in PHP 5.2.
git-svn-id: https://develop.svn.wordpress.org/trunk@32177 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 09:40:11 +00:00
Gary Pendergast
94f02ef8b1 In Multisite, prevent plugins from unintentionally switching sites.
Props mdawaffe.



git-svn-id: https://develop.svn.wordpress.org/trunk@32173 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 07:26:05 +00:00
Gary Pendergast
332750a40d Revert [30640], as it was incorrectly checking some filenames.
git-svn-id: https://develop.svn.wordpress.org/trunk@32171 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 06:38:08 +00:00
Gary Pendergast
96f12cc588 Clean up some edge cases in sanitize_sql_orderby().
Props vortfu, dd32.



git-svn-id: https://develop.svn.wordpress.org/trunk@32164 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 05:41:37 +00:00
Gary Pendergast
faa66d8145 WPDB: When sanity checking read queries, there are some collations we can skip, for improved performance.
Props pento, nacin.

See #21212.



git-svn-id: https://develop.svn.wordpress.org/trunk@32162 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-20 04:45:12 +00:00
Boone Gorges
bf3773dbfb During PHPUnit tests, don't autodetect permalink structure during WP installation.
The unit tests expect non-pretty permalinks, so there's no benefit to detecting
the ability to have pretty permalinks. Moreover, the `wp_remote_get()` call can
cause installation to hang when there are DNS issues.

Fixes #31994.

git-svn-id: https://develop.svn.wordpress.org/trunk@32139 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-16 23:59:01 +00:00
Sergey Biryukov
3b6ff03136 wp_update_term() should check if get_term() returned null.
props dlh.
fixes #31954.

git-svn-id: https://develop.svn.wordpress.org/trunk@32117 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-13 01:20:57 +00:00
Gary Pendergast
b806e118c6 When dbDelta() is checking whether an index is defined in a CREATE TABLE statement, don't worry if MySQL has a subpart defined on an index, but the CREATE TABLE doesn't.
Fixes #31869.



git-svn-id: https://develop.svn.wordpress.org/trunk@32108 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-11 10:39:49 +00:00
Gary Pendergast
1de9bc1670 Smilies: Tweak which smiley matches which emoji.
Props iseulde.

See #31709.



git-svn-id: https://develop.svn.wordpress.org/trunk@32105 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-10 06:29:49 +00:00
Gary Pendergast
3bd66eff61 Smilies: Update our few remaining smilies to better align with Twemoji, and add frownie.png until Twemoji provide a build containing it.
Props joen.

See #31709.



git-svn-id: https://develop.svn.wordpress.org/trunk@32104 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-10 06:19:39 +00:00
Boone Gorges
bffb632183 Improve handling of incomplete From and Content-Type headers in wp_mail().
When an incomplete header is provided (eg, 'From' with an email address but no
name), ensure that the WP defaults are filled in properly.

Props valendesigns.
Fixes #30266.

git-svn-id: https://develop.svn.wordpress.org/trunk@32070 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-07 20:09:46 +00:00
Boone Gorges
ddb33c9aed After [31114] and [31323], 'View Post' generated in get_sample_permalink_html() should go to pretty permalink.
`get_permalink()` will return a non-pretty permalink for future posts, which
breaks some user workflows that expect View Post to lead to a page with the
pretty permalink.

Fixes #30910.

git-svn-id: https://develop.svn.wordpress.org/trunk@32002 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-04 01:26:08 +00:00
Boone Gorges
468da41811 WP_User_Query: When querying users with 'fields=all', ensure that caps and roles are filled for the current site.
See [15566] for a parallel fix for 'fields=all_with_meta'.

Fixes #31878.

git-svn-id: https://develop.svn.wordpress.org/trunk@32001 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-03 14:13:19 +00:00
Boone Gorges
86f074ffde Unit tests verifying the filling of the 'roles' and 'caps' user properties during WP_User_Query.
See #31878.

git-svn-id: https://develop.svn.wordpress.org/trunk@32000 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-03 14:13:11 +00:00
John Blackbourn
d92cc07d91 Correctly set the post author in wp_xmlrpc_server::mw_editPost() when the current user is not the author of the post.
Props redsweater, markoheijnen, DrewAPicture
Fixes #24916


git-svn-id: https://develop.svn.wordpress.org/trunk@31983 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 15:48:41 +00:00
Sergey Biryukov
4738590d5e Avoid duplicate classes for different terms with UTF-8 slugs in post_class() and body_class().
Fall back to term ID if the sanitized slug is numeric or only contains hyphens.

props SergeyBiryukov, A5hleyRich, sgrant, davideugenepratt.
fixes #30883.

git-svn-id: https://develop.svn.wordpress.org/trunk@31979 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 01:04:22 +00:00
Gary Pendergast
b9537f9488 Unit Tests added in [31970] need to be restricted to run in Multisite only.
See #17904, #26784.



git-svn-id: https://develop.svn.wordpress.org/trunk@31978 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-02 00:12:07 +00:00
Boone Gorges
4201382267 Unit tests for wpmu_validate_user_signup().
See #17904, #26784.

git-svn-id: https://develop.svn.wordpress.org/trunk@31970 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 21:37:34 +00:00
Scott Taylor
d1235e323e Respect numerical keys in add_query_arg(), use array_replace() instead of array_merge().
Adds unit test.

Props tyxla.
Fixes #31306.


git-svn-id: https://develop.svn.wordpress.org/trunk@31966 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 19:14:46 +00:00
Scott Taylor
bcf98c7742 Alter the regex in wptexturize() to properly handle input like: <> "Hello world" <>.
Updates unit test data.

Props miqrogroove.
Fixes #30344.


git-svn-id: https://develop.svn.wordpress.org/trunk@31965 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 19:08:31 +00:00
Scott Taylor
2418711c47 When updating the email address for an existing user, make sure the email address is not already in use.
Adds unit tests.

Props rittesh.patel, DrewAPicture.
Fixes #30647.


git-svn-id: https://develop.svn.wordpress.org/trunk@31963 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 18:22:16 +00:00
Gary Pendergast
ed374ae10e WPDB: Due to PHP 5.2's internal string handling, strings in Windows are encoded using UTF-16, instead of UTF-8. With the addition of the many character set tests in [30345], a couple of them were tripping up in PHP 5.2 under Windows, because of this behaviour.
This marks those tests as skipped.

See #31262 for more discussion.



git-svn-id: https://develop.svn.wordpress.org/trunk@31953 602fd350-edb4-49c9-b593-d223f7449a82
2015-04-01 12:33:39 +00:00
Gary Pendergast
4e6cb8a5e2 Emoji: Fix a unit test which was incorrectly failing after [31926] fixed emoji being incorrectly encoded.
git-svn-id: https://develop.svn.wordpress.org/trunk@31940 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 09:36:29 +00:00
Dion Hulse
9ce354f534 Tests: Clean up the resulting /tmp/foo* files from the tempnam call.
git-svn-id: https://develop.svn.wordpress.org/trunk@31937 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 02:10:52 +00:00
Dion Hulse
842d6a9b39 Add some logic into wp_tempnam to prevent it creating 'falsey' directory names that might get used elsewhere within WordPress.
Although this logic looks a little strange at this low level, it's the best location within the Upgrades code for it to happen.
Fixes #31811


git-svn-id: https://develop.svn.wordpress.org/trunk@31936 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-31 02:10:06 +00:00
Gary Pendergast
eced539d8b Emoji: [31864] changed emoji image's inline style from height to max-height. Unfortunately, anything using feedparser.py (for example, NewsBlur) strips out max-height, which gives us massive emoji in feeds.
This re-adds `height`, and also reminds us why we can't have nice things.

See #31719.



git-svn-id: https://develop.svn.wordpress.org/trunk@31909 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-27 02:11:45 +00:00
Gary Pendergast
b3e3766233 Emoji: Gmail doesn't obey an <img>'s inline CSS height rule, transforming it to min-height. To avoid giant smiley faces everywhere, we're changing the height rule to max-height, which Gmail plays nicer with.
Props janhenckens.

Fixes #31719.



git-svn-id: https://develop.svn.wordpress.org/trunk@31864 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-23 12:07:47 +00:00
Boone Gorges
6d7c4f39f0 Use shared fixtures in RSS2 unit tests.
See #31705, #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@31848 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:34:28 +00:00
Boone Gorges
bb2ddebec9 Enforce non-pretty permalinks in RSS2 tests.
Previously, the tests were using '/feed/' in their `go_to()` statements, but
testing nodes for URLs like '?p='. This mismatch created unpredictable results
when the run in certain sequences with other groups of unit tests.

See #31705.

git-svn-id: https://develop.svn.wordpress.org/trunk@31846 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:25:27 +00:00
Boone Gorges
6de5ae56dd Ensure that fixtures in RSS2 tests have an author.
This makes the 'dc:creator' assertions more meaningful.

Props ianmjones.
See #31705.

git-svn-id: https://develop.svn.wordpress.org/trunk@31845 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-20 12:25:18 +00:00
Boone Gorges
819ea5cabe Move and tests to their own files.
git-svn-id: https://develop.svn.wordpress.org/trunk@31812 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-18 13:27:15 +00:00
Boone Gorges
12784e13d4 Improve method consistency in WP_Comment_Query.
* Introduce a `__construct()` method, which can accept an array of query vars.
* Move query logic out of `query()` method and into a new `get_comments()` method.
* Ensure that `$this->comments` is set whenever `get_comments()` returns a value.
* Introduce a `parse_query()` method, where query vars are parsed with default values and the 'parse_comment_query' action is fired.

These changes bring `WP_Comment_Query` syntax closer to that of `WP_Query`.

Props westonruter, morganestes, boonebgorges.
Fixes #24826.

git-svn-id: https://develop.svn.wordpress.org/trunk@31793 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-16 14:23:33 +00:00
Boone Gorges
ec49827b0b In wp_insert_term(), allow a term with an existing name if a unique $slug has been provided.
`wp_insert_term()` protects against the creation of terms with duplicate names
at the same level of a taxonomy hierarchy. However, it's historically been
possible to override this protection by explicitly providing a value of `$slug`
that is unique at the hierarchy tier. This ability was broken in [31734], and
the current changeset restores the original behavior.

A number of unit tests are added and refactored in support of these changes.

See #17689 for discussion of a fix that was superceded by [31734]. This commit
retains the fix for the underlying bug described in that ticket.

See #31328.

git-svn-id: https://develop.svn.wordpress.org/trunk@31792 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-16 11:15:34 +00:00
Gary Pendergast
1c63c533b1 Tests: Since [31733], we now encode emoji in posts, instead of removing them (when they're being stored in versions of MySQL that don't support utf8mb4).
git-svn-id: https://develop.svn.wordpress.org/trunk@31782 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-15 11:50:54 +00:00
Gary Pendergast
3503aa4820 Smilies: The new smilies added in [31733] and [31745] are larger than the old smilies. While this is taken care of by the CSS on normal pages, it means they're disproportionally large when seen in RSS and email.
By adding a little bit of inline style to them, we get pleasingly sized smilies everywhere. :-)

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31781 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-15 11:40:16 +00:00
Boone Gorges
13e66393f1 Don't run wp_get_archives() cache test on multisite.
The introduction of a Customizer test that creates a new blog [31707] causes
`WP_INSTALLING` to be set by the time the `wp_get_archives()` tests run. This,
in turn, causes the query counts to vary in unpredictable ways.

See #31130.

git-svn-id: https://develop.svn.wordpress.org/trunk@31764 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-12 23:29:21 +00:00
Helen Hou-Sandi
21134a0c89 Allow is_page_template() to accept an array, as many other conditional tags do.
props morganestes, tyxla, DrewAPicture.
fixes #31271.


git-svn-id: https://develop.svn.wordpress.org/trunk@31754 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-12 16:27:06 +00:00
Gary Pendergast
1357e7fc2e Add emoji URL support, and Twemoji fallback for displaying slugs in wp-admin, when the browser doesn't natively support emoji.
Props pento, SergeyBiryukov and boonebgorges.

Fixes #31328



git-svn-id: https://develop.svn.wordpress.org/trunk@31734 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 22:54:49 +00:00
Gary Pendergast
ae391ec226 Add emoji support, with Twemoji fallback.
Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.

Props batmoo, joen and mkaz for the original plugin upon which this is based.

Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31733 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 22:48:16 +00:00
John Blackbourn
82ac76c0a7 Introduce a new algorithm for displaying a hierarchical list of post objects in the WP_Posts_List_Table. This reduces processing time, reduces database queries, and substantially reduces memory use on sites with a high number of Pages.
Props nofearinc, rodrigosprimo, nacin, johnbillion.
Fixes #15459


git-svn-id: https://develop.svn.wordpress.org/trunk@31730 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 20:45:17 +00:00
Helen Hou-Sandi
22f174c106 Fix a unit test after [31721].
props jipmoors.
see #22329.


git-svn-id: https://develop.svn.wordpress.org/trunk@31728 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 20:11:38 +00:00
Dominik Schilling (ocean90)
32a124a884 Customizer: Return the original value when filtering theme mods/options and the current blog has changed.
props westonruter.
fixes #31428.

git-svn-id: https://develop.svn.wordpress.org/trunk@31707 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 23:04:12 +00:00
Dominik Schilling (ocean90)
63502a8a01 Customizer: Fix previewing and applying widgets when previewing another theme.
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.

git-svn-id: https://develop.svn.wordpress.org/trunk@31705 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 22:38:30 +00:00
Boone Gorges
8072fe7db6 Improved customizability for the Submit button in comment_form().
The new 'submit_button' and 'submit_field' parameters for `comment_form()`
allow developers to modify the markup of the submit button and its wrapper.
These params are accompanied by targeted 'comment_form_submit_button' and
'comment_form_submit_field' filters on the concatenated markup.

Props coffee2code, morpheu5, DrewAPicture, boonebgorges.
Fixes #15015.

git-svn-id: https://develop.svn.wordpress.org/trunk@31699 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 19:07:31 +00:00
Sergey Biryukov
5fe8182c7f EXIF/IPTC captions should populate Caption (post_excerpt) on upload, not Description (post_content).
Make sure the caption is always set if found. Previously, if the caption was less than 80 characters, only the Title field would be set.

props beaulebens, ericlewis, bendoh, SergeyBiryukov.
fixes #22768.

git-svn-id: https://develop.svn.wordpress.org/trunk@31694 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-10 05:06:39 +00:00
Boone Gorges
969c850149 Share fixtures across wp_list_authors() tests.
See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@31676 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-08 15:57:02 +00:00
Boone Gorges
5bb3e71cc0 Whitelist 'psd' for uploads when testing `wp_attachment_is() on multisite.
It's not allowed by default, which causes the fixture not to be built.

See #25275 [31647].

git-svn-id: https://develop.svn.wordpress.org/trunk@31670 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 18:47:04 +00:00
Boone Gorges
a11372afe1 Improved 'orderby' meta syntax in WP_User_Query.
Recent commits have added the ability to order query results by specific
clauses of the 'meta_query' parameter (comments [31467], posts [31312] and
[31340]). The current changeset ports the same functionality to `WP_User_Query`.

Also introduced is the ability to pass the value of `$meta_key` to 'orderby'.

The internals of `WP_User_Query::prepare_users()` had to be reordered
somewhat to support these changes, primarily to ensure that the `meta_query`
object generates its SQL clauses before the 'orderby' parameter is parsed.

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31669 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 18:37:05 +00:00
Boone Gorges
6a4839bd83 User query meta_vars test must account for the 'blog_id' clause added in multisite.
See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31668 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 17:33:48 +00:00
Boone Gorges
0fb3e2566f Add tests for the conversion of 'meta_*' query vars to $meta_query objects in all query classes.
See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31666 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 16:34:50 +00:00
Boone Gorges
945fd67d7b Improve 'orderby' syntax for WP_User_Query.
This changeset ports a number of 'orderby' features from `WP_Query` and
`WP_Comment_Query`:

* Allow multiple 'orderby' values to be passed as a space-separated list.
* Allow multiple 'orderby' values to be passed as a flat array.
* Allow multi-dimensional 'orderby', with orderby fields as array keys and ASC/DESC as the corresponding values.

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31663 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 16:05:11 +00:00
Boone Gorges
3262ff0cc8 Tests for some existing 'orderby' functionality in WP_*_Query classes.
* In `WP_Query` and `WP_Comment_Query`, ensure that 'orderby' can parse multiple values for 'orderby' when passed as a space-separated string.
* In `WP_User_Query`, ensure that "shorthand" orderbys (like 'login' and 'name') are converted to their full versions (like 'user_login' and 'display_name').

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31662 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 15:44:28 +00:00
Boone Gorges
b2332718a1 When passing $full to get_posts_by_author_sql(), make sure a 'post_type' clause is included in results.
This change makes the 'post_type' clause in `wp_list_authors()` redundant, so
we remove it. Third-party plugins using `get_posts_by_author_sql()` may have
similarly redundant clauses, but this won't change the results returned by the
SQL queries.

Also adds unit tests for `get_posts_by_author_sql()`.

Props pbearne.
Fixes #30354.

git-svn-id: https://develop.svn.wordpress.org/trunk@31653 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-07 01:14:31 +00:00
Scott Taylor
8a28e19808 Add unit tests for wp_attachment_is(), checks the whitelist and arbitrary extension.
See #25275.


git-svn-id: https://develop.svn.wordpress.org/trunk@31647 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-06 20:37:08 +00:00
Boone Gorges
b9e222fd6a Allow $autoload setting to be changed for existing options using update_option().
[31628] made it possible to pass an `$autoload` param to `update_option()` that
applies when the option does not yet exist in the database. The current
changeset introduces parity for existing options: the `$autoload` setting
for existing options can be changed via the `$autoload` parameter. For internal
simplicity, `$autoload` is ignored for existing options when `$value` is not
also changed.

This changeset also moves `update_option()` tests into their own class.

Props dd32.
Fixes #26394.

git-svn-id: https://develop.svn.wordpress.org/trunk@31640 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-06 13:56:44 +00:00
Boone Gorges
67324a9234 Introduce $autoload parameter to update_option().
When creating an option via `add_option()`, the `$autoload` param allows you to
tell WP whether the option should be loaded as part of the 'alloptions' cache
during every pageload. `update_option()`, when used with a non-existent option
calls `add_option()` internally. The new `$autoload` param in `update_option()`
is passed along to `add_option()` in cases where the option does not yet exist.

The associated unit tests are skipped on multisite due to an issue that causes
`WP_INSTALLING` to force cache misses. See #31130.

Props codix, nofearinc, MikeHansenMe.
Fixes #26394.

git-svn-id: https://develop.svn.wordpress.org/trunk@31628 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 19:13:00 +00:00
Boone Gorges
c4e9c64233 Pinking shears in unit test files.
git-svn-id: https://develop.svn.wordpress.org/trunk@31623 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 13:14:28 +00:00
Boone Gorges
067fa3702e In PHPUnit test classes, parent::tearDown() should be the last thing done in tearDown() methods.
`WP_UnitTestCase::tearDown()` restores the test environment to the default
conditions, including rolling back the MySQL transaction that the test takes
place in, resetting globals, and unhooking test-specific filters. As such, all
teardown routines for specific tests should happen before the parent class's
`tearDown()` method is called. Failure to do so can cause database locks on
certain configurations, among other problems.

See #31537.

git-svn-id: https://develop.svn.wordpress.org/trunk@31622 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 13:14:15 +00:00
Boone Gorges
07abae914e In get_next_comments_link(), ensure proper pagination when no 'cpage' query var is found.
The 'cpage' query var is only set when using `comments_template()` to display
comments. If displaying them in a context where 'cpage' is not yet set, the
default value should be 1, not 0.

Props MomDad, couturefreak.
Fixes #20319.

git-svn-id: https://develop.svn.wordpress.org/trunk@31617 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 03:56:21 +00:00
Boone Gorges
c1b30747d5 Respect comment_date and comment_date_gmt params in wp_new_comment().
Props solarissmoke, oso96_2000.
Fixes #14279.

git-svn-id: https://develop.svn.wordpress.org/trunk@31615 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 02:59:47 +00:00
Boone Gorges
1ee4d99972 In wp_get_attachment_url(), convert to HTTPS when possible.
`wp_get_attachment_url()`, via `wp_upload_dir()`, uses 'siteurl' to generate
attachment URLs. When a site is SSL-optional on the front end - ie, 'siteurl'
is non-HTTPS, but SSL is available - a number of situations can arise where
non-HTTPS attachment URLs cause browser mixed-content warnings:

a) SSL is forced in the admin and `wp_get_attachment_url()` is used to generate the `<img>` tag for an inserted image. In these cases, the post content will contain non-HTTPS. Viewing/editing this post in the Dashboard will result in non-HTTPS images being served in an SSL environment.
b) `wp_get_attachment_url()` is used in a theme to generate an `<img>` `src` attribute on a public page. When viewing that page over SSL, the images will have HTTP URLs.

This changeset switches attachment URLs to HTTPS when it's determined that the
host supports SSL. This happens when 'siteurl' is non-SSL, but the current page
request *is* over SSL, and the host of the current request matches the host of
the URL being generated.

Props joemcgill, boonebgorges.
Fixes #15928.

git-svn-id: https://develop.svn.wordpress.org/trunk@31614 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-05 02:38:59 +00:00
Gary Pendergast
d258490653 When sanitizing a URL to redirect to, UTF-8 characters can be URL encoded, instead of being removed.
While RFC 3986 does not specify which character sets are allowed in URIs, Section 2.5 states that octects matching UTF-8 character encoding should be percent-encoded, then unreserved octets outside of the UTF-8 range should be percent-encoded. As browsers tend to only implement support for UTF-8 in URLs, this change only implements the UTF-8 encoding part. We may revisit the second part if it becomes an issue.

Fixes #31486



git-svn-id: https://develop.svn.wordpress.org/trunk@31587 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-28 02:20:52 +00:00
Scott Taylor
65c58832cb Improve get_media_embedded_in_content() so that it returns the media it finds in the same order that it appears in the content.
Adds unit test, updates another.

Props kopepasah.
See #26675.


git-svn-id: https://develop.svn.wordpress.org/trunk@31574 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-27 16:11:00 +00:00
Boone Gorges
e365b3a364 Add 'orderby=description' support to get_terms().
This fixes an interface inconsistency in edit-tags.php, where Description
appears as a sortable column header.

Props neil_pie.
Fixes #31364.

git-svn-id: https://develop.svn.wordpress.org/trunk@31532 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-24 16:36:26 +00:00
Sergey Biryukov
4d61c79ca1 Fix line endings after [31522].
fixes #31430.

git-svn-id: https://develop.svn.wordpress.org/trunk@31531 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-24 10:05:48 +00:00
Sergey Biryukov
0421ee26ec Add unit tests for get_page_template_slug().
props tyxla.
fixes #31389.

git-svn-id: https://develop.svn.wordpress.org/trunk@31522 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-23 18:47:01 +00:00
Boone Gorges
129e5f5278 Ensure that a request URL is always set in WP_UnitTestCase::go_to().
Failure to set this variable meant that passing the home URL to `go_to()`
(without a trailing slash) resulted in a PHP notice, and failed to reset the
globals properly.

Props joostdevalk.
Fixes #31417.

git-svn-id: https://develop.svn.wordpress.org/trunk@31515 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-23 01:07:18 +00:00
Boone Gorges
1beeccc96f Use PHP 5.2 compatible syntax in image tests.
T_PAAMAYIM_NEKUDOTAYIM, HAKUNA_MATATA, YOLO.

See [31510], #31124.

git-svn-id: https://develop.svn.wordpress.org/trunk@31512 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-22 21:41:22 +00:00
Boone Gorges
d854564f73 Better image-type support checks in image unit tests.
PHP can be compiled without support for certain image types. Our unit tests
should be sensitive to these configurations.

Fixes #31124.

git-svn-id: https://develop.svn.wordpress.org/trunk@31510 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-22 21:06:36 +00:00
Boone Gorges
94791cd8f2 Respect 'default_option_' filters during early sanity checks in add_option() and update_option().
`add_option()` and `update_option()` both call `get_option()` to compare the
value passed to the function with any existing value for the given option name.
When a `'default_option_'` filter is in place to change the default value of
an option, `add_option()` and `update_option()` ought to check against the
filtered value, rather than a hardcoded `false`, in order to determine whether
a prior value exists.

Props GregLone, tyxla.
Fixes #31047.

git-svn-id: https://develop.svn.wordpress.org/trunk@31473 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-18 19:13:43 +00:00
Boone Gorges
086e03e8e2 Improved handling of expectedDeprecated and expectedIncorrectUsage annotations in unit tests.
* Do the `expectedDeprecated()` check in `assertPostConditions()` instead of `tearDown()`. Previously, `fail`ing inside of `tearDown()` was causing the rest of the teardown process to be aborted, resulting in inter-test leakage.
* Collect all `expectedDeprecated` and `expectedIncorrectUsage` annotations in an entire method and display them all when `fail`ing, instead of showing only the first one.

Props jdgrimes.
Fixes #31362.

git-svn-id: https://develop.svn.wordpress.org/trunk@31469 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-17 16:11:09 +00:00
Boone Gorges
8bf5fce78f Improve 'orderby' syntax for WP_Comment_Query.
Since [29027], `WP_Query` has supported an array of values for the `$orderby`
parameter, with field names as array keys and ASC/DESC as the array values.
This changeset introduces the same syntax to `WP_Comment_Query`.

We leverage the new support for multiple ORDER BY clauses to fix a bug that
causes comments to be queried in an indeterminate order when sorting by the
default `comment_date_gmt` and comments share the same value for
`comment_date_gmt`. By always including a `comment_ID` subclause at the end of
the ORDER BY statement, we ensure that comments always have a unique fallback
for sorting.

This changeset also includes improvements paralleling those introduced to
`WP_Query` in [31312] and [31340], which allow `$orderby` to accept array keys
from specific `$meta_query` clauses. This change lets devs sort by multiple
clauses of an associated meta query. See #31045.

Fixes #30478. See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31467 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-16 14:09:40 +00:00
Boone Gorges
4138275df9 More careful type conversion in WP_Query is_*() methods.
`is_array( 1, '1-foo' )` returns true, which means that `is_page( 1 )`
was returning true when on a page with the slug '1-foo'. We avoid this odd
behavior by casting the queried object ID to a string before testing against
the value passed to the conditional function.

This also helps to avoid a problem where an arbitrary value for `$page` would
cause `is_page( $page )` to return true if the query had been manipulated by
a plugin to show that the current page's ID is 0.

Props boonebgorges, r-a-y, nunomorgadinho, wonderboymusic, clifgriffin.
Fixes #24674.

git-svn-id: https://develop.svn.wordpress.org/trunk@31458 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-14 02:08:46 +00:00
Sergey Biryukov
78b02ec722 Use more descriptive names for register_post_type() and register_taxonomy() tests with too long and too short names.
see #31134, #31135.

git-svn-id: https://develop.svn.wordpress.org/trunk@31457 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-13 23:33:56 +00:00
John Blackbourn
f4d6d4e66b Return a WP_Error if an empty name is provided when registering a post type.
Fixes #31134
Props tyxla, MikeHansenMe


git-svn-id: https://develop.svn.wordpress.org/trunk@31450 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-13 16:42:36 +00:00
John Blackbourn
22fc19e06d Return a WP_Error if an empty name is provided when registering a taxonomy.
Fixes #31135
Props tyxla, MikeHansenMe


git-svn-id: https://develop.svn.wordpress.org/trunk@31449 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-13 16:26:37 +00:00
Boone Gorges
ab10e5fe71 Add tests for some of WP_Query's sticky post logic.
See #27282.

git-svn-id: https://develop.svn.wordpress.org/trunk@31439 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-13 02:24:57 +00:00
Dion Hulse
afef491a75 Avoid a PHP Warning when add_args is passed as false to paginate_links().
Props boonebgorges for the unit test.
See #30831 [31203].


git-svn-id: https://develop.svn.wordpress.org/trunk@31432 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-12 01:38:26 +00:00
Dominik Schilling (ocean90)
d4c47d6364 Fix failing Tests_Dependencies_jQuery::test_wp_script_is_dep_enqueued test.
[31370] has broken the test because the Customizer test enqueues some scripts. Unset `$GLOBALS['wp_scripts']` on tearDown() so other tests will start with zero enqueued scripts.

see #30936.
fixes #31302.

git-svn-id: https://develop.svn.wordpress.org/trunk@31426 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-11 22:44:20 +00:00
Boone Gorges
ed639b408a Split shared taxonomy terms on term update.
When updating an existing taxonomy term that shares its `term_id` with
another term, we generate a new row in `wp_terms` and associate the updated
term_taxonomy_id with the new term. This separates the terms, such that
updating the name of one term does not change the name of any others.

In cases where a plugin or theme stores term IDs in the database, term splitting
can cause backward compatibility issues. The current changeset introduces
two utilities to aid developers with the transition. The `'split_shared_term'`
action fires when the split takes place, and should be used to catch changes in
term_id. In cases where `'split_shared_term'` cannot be used, the
`wp_get_split_term()` function gives developers access to data about terms
that have previously been split. Documentation for these functions, with
examples, can be found in the Plugin Developer Handbook. WordPress itself
stores term IDs in this way in two places; `_wp_check_split_default_terms()`
and `_wp_check_split_terms_in_menus()` are hooked to `'split_shared_term'` to
perform the necessary cleanup.

See [30241] for a previous attempt at the split. It was reverted in [30585]
for 4.1.0.

Props boonebgorges, mboynes.
See #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@31418 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-11 19:41:54 +00:00
Sergey Biryukov
757fd2c1e4 Always pass back the custom classes get_post_class() was called with, even if the post was not found.
props F J Kaiser, Bueltge.
fixes #22271.

git-svn-id: https://develop.svn.wordpress.org/trunk@31408 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-11 03:59:06 +00:00
Boone Gorges
d4fbf04671 Don't parse empty 'tax_input' keys in edit_post().
This fixes a bug introduced in [31359] where saving a tax_input that contained
only whitespace would result in a random tag being erroneously added to the
post.

See #30615.

git-svn-id: https://develop.svn.wordpress.org/trunk@31392 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-09 22:53:40 +00:00
Gary Pendergast
be3c59e64c WPDB: Some character set tests were failing if DB_CHARSET was empty, or a non-utf8 character set.
git-svn-id: https://develop.svn.wordpress.org/trunk@31372 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-09 00:38:11 +00:00
Dominik Schilling (ocean90)
2518bbbb1f Customizer: Introduce an API to create WP_Customize_Settings for dynamically-created settings.
* Introduce WP_Customize_Manager::add_dynamic_settings() to register dynamically-created settings.
* Introduce `customize_dynamic_setting_args` filter to pass an array of args to a dynamic setting's constructor.
* Add unit tests for WP_Customize_Manager and WP_Customize_Widgets.
* See WP_Customize_Widgets as an example.

props westonruter.
fixes #30936.

git-svn-id: https://develop.svn.wordpress.org/trunk@31370 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-08 23:10:05 +00:00
Boone Gorges
76b84b9231 Add orderby=meta_value_num support to WP_User_Query.
Props tyxla, genkisan.
Fixes #27887.

git-svn-id: https://develop.svn.wordpress.org/trunk@31369 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-08 16:58:14 +00:00
Boone Gorges
bdda122e7f In WP_Query::get_queried_object(), avoid PHP notices when is_tax is paired with an empty tax_query.
It's possible to have an empty `tax_query` and `is_tax=true` when the initial
query contains a taxonomy var (and is processed as such during
`WP_Query::parse_query()`) but the taxonomy var is unset during a 'parse_query'
callback. While this kind of behavior is not necessarily something we need to
support, we should continue to avoid PHP notices in such cases, as we did prior
to WP 4.1.

Fixes #31246.

git-svn-id: https://develop.svn.wordpress.org/trunk@31366 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-07 19:49:17 +00:00
Boone Gorges
fb4048fcdd Parse non-hierarchical tag input into term IDs before sending to wp_insert_post().
When editing a post, non-hierarchical taxonomy terms are sent as the
comma-separated list entered into the tax_input metabox. Passing these
values directly to `wp_update_post()` meant that they were interpreted as
term slugs rather than term names, causing mismatches when a typed string
matched the slug of one term and the name of a different term. We fix the
problem by preprocessing tax_input data sent from post.php, converting it to
unambiguous term_ids before saving.

Props boonebgorges, ArminBraun.
Fixes #30615.

git-svn-id: https://develop.svn.wordpress.org/trunk@31359 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-06 20:31:37 +00:00
Gary Pendergast
9f6ddf8944 WPDB: If a site is using the utf8 charset, and their version of MySQL supports utf8mb4, auto-upgrade them to utf8mb4.
This patch also resizes some indexes, to allow for the 767 byte index size limit in standard MySQL installs.

See #21212



git-svn-id: https://develop.svn.wordpress.org/trunk@31349 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-06 04:50:19 +00:00
Boone Gorges
41db99c31a Use field-specific sanitization in WP_Tax_Query::transform_query().
When terms are entered into the database, term fields are sanitized with
`sanitize_term_field()`. To ensure that the `SELECT ... WHERE` queries in
`WP_Tax_Query::transform_query()` are not broken by overzealous sanitization,
`sanitize_term_field()` should be used in that case as well. This fixes a bug
where a tax_query using 'field=name' would fail if the 'terms' parameter
contained characters (like spaces) that were improperly removed by
`sanitize_title_for_query()`.

Fixes #27810.

git-svn-id: https://develop.svn.wordpress.org/trunk@31346 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-06 02:01:24 +00:00
Boone Gorges
90947c2c45 Another array syntax fix for Customizer tests.
See [31339], #30988.

git-svn-id: https://develop.svn.wordpress.org/trunk@31342 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-05 19:54:06 +00:00
Boone Gorges
0f28011bcf Modify `meta_query orderby syntax to use array keys as clause "handles".
The implementation of `meta_query` orderby introduced in [31312] put clause
identifiers into a 'name' parameter of the clause. For greater clarity, this
changeset updates the syntax to use the associative array key used when
defining `meta_query` parameters, instead of the 'name' parameter.

Props Funkatronic, DrewAPicture.
Fixes #31045.

git-svn-id: https://develop.svn.wordpress.org/trunk@31340 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-05 19:37:47 +00:00
Boone Gorges
9d72e1c6a2 Use temporary variable for array in Tests_Customize_Setting::test_preview_standard_types_multidimensional().
The syntax previously used - `call_user_func( 'foo' )['bar']`, where `foo()`
returns an array - is not valid on all supported versions of PHP, and was
breaking the CI builds.

See #30988.

git-svn-id: https://develop.svn.wordpress.org/trunk@31339 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-05 19:18:16 +00:00
Boone Gorges
c9c9af5df8 Introduce 'value_field' parameter to wp_dropdown_pages().
This parameter allows developers to choose the post field that will be used to
fill in the 'option' attribute of the generated dropdown markup.

See [31006] #30306 for a parallel enhancement in `wp_dropdown_categories()`.

Props jfarthing84.
Fixes #12494.

git-svn-id: https://develop.svn.wordpress.org/trunk@31338 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-05 19:03:52 +00:00
Dominik Schilling (ocean90)
8bc9ad756d Ensure that WP_Customize_Setting::value() returns default value for setting if not dirty.
There was regression introduced by #28580 where only changed (dirty) settings now are POST'ed to the Customizer preview.

* Allow WP_Customize_Manager::post_value() to accept a second $default argument.
* Introduce WP_Customize_Manager::unsanitized_post_values() for accessing previously-private member variable _post_values.
* Do require_once instead of require for Customizer classes.
* Add unit tests for WP_Customize_Manager and WP_Customize_Setting.

props westonruter.
fixes #30988.

git-svn-id: https://develop.svn.wordpress.org/trunk@31329 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-03 10:14:28 +00:00
Sergey Biryukov
5e9b89bf59 When using WP_Query's 'fields' => 'ids' (or 'fields' => 'id=>parent'), make sure the returned result is always an array of integers.
fixes #31194. see #27252.

git-svn-id: https://develop.svn.wordpress.org/trunk@31324 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-03 02:28:52 +00:00
Boone Gorges
f05f380638 In get_sample_permalink(), override 'future' status before generating permalink.
In [31114], `get_permalink()` was modified to prevent pretty permalinks from
being generated for posts with the 'future' post status. This inadvertently
broke the pretty permalink preview for scheduled posts. The fix is to include
the 'future' status in the list of statuses that `get_sample_permalink()` fakes
as 'publish' before it fetches a permalink.

Props DrewAPicture.
Fixes #30910.

git-svn-id: https://develop.svn.wordpress.org/trunk@31323 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-02 16:49:23 +00:00
Boone Gorges
5f6ea53e86 When querying for a specific post, allow posts with a non-public status to be returned as long as that status is specified.
This makes it possible to, for example, retrieve a specific post using the
`p` parameter of `WP_Query`, even if the post is in the Trash, by including
the `post_status=trash` parameter.

Props ebinnion.
Fixes #29167.

git-svn-id: https://develop.svn.wordpress.org/trunk@31321 602fd350-edb4-49c9-b593-d223f7449a82
2015-02-01 20:25:42 +00:00
Andrew Ozz
9391d4f572 Separate the tests for IE conditional comments support in WP_Scripts. Props valendesigns, see 16024.
git-svn-id: https://develop.svn.wordpress.org/trunk@31317 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-31 20:40:49 +00:00
Boone Gorges
32f2903248 Prevent terms in a show_in_quick_edit=false taxonomy from being updated by a faked AJAX request.
The UI for these taxonomies was hidden in [31308], but it remained possible to
send a direct POST request to the `inline-edit` endpoint to bypass the
restriction. The current changeset fixes this.

Props meloniq.
Fixes #26948.

git-svn-id: https://develop.svn.wordpress.org/trunk@31313 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-31 19:37:12 +00:00
Boone Gorges
2d737796d2 Improve support for ordering WP_Query results by postmeta.
`WP_Meta_Query` clauses now support a 'name' parameter. When building a
`WP_Query` object, the value of 'orderby' can reference this 'name', so that
it's possible to order by any clause in a meta_query, not just the first one
(as when using 'orderby=meta_value'). This improvement also makes it possible
to order by multiple meta query clauses (or by any other eligible field plus
a meta query clause), using the array syntax for 'orderby' introduced in [29027].

Props Funkatronic, boonebgorges.
Fixes #31045.

git-svn-id: https://develop.svn.wordpress.org/trunk@31312 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-31 15:47:51 +00:00
Sergey Biryukov
f36af772ea Remove redundant parameter.
see #30753.

git-svn-id: https://develop.svn.wordpress.org/trunk@31311 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-31 02:11:46 +00:00
Sergey Biryukov
12156f6fab Add a unit test that expects wp_parse_args() to treat 'true' and 'false' in a query string as strings.
props voldemortensen for initial patch.
see #30753.

git-svn-id: https://develop.svn.wordpress.org/trunk@31310 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-31 02:01:46 +00:00
Boone Gorges
057c428346 Introduce 'show_in_quick_edit' parameter for register_taxonomy().
Setting 'show_in_quick_edit' to false when registering a custom taxonomy will
hide the taxonomy when editing posts using Quick Edit.

The new 'quick_edit_show_taxonomy' filter allows this behavior to be filtered
on a finer scale, as when you want a given taxonomy to be hidden for one post
type but not for others.

Props hlashbrooke.
Fixes #26948.

git-svn-id: https://develop.svn.wordpress.org/trunk@31307 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-30 19:17:51 +00:00
Boone Gorges
2fb8562a97 Introduce setExpectedDeprecated() and setExpectedIncorrectUsage() methods to `WP_UnitTestCase.
These methods provide a procedural alternative to the `@expectedDeprecated`
and `@expectedIncorrectUsage` test annotations, and parallel PHPUnit's native
`setExpectedException()`.

Props prasoon2211, jdgrimes.
Fixes #28486.

git-svn-id: https://develop.svn.wordpress.org/trunk@31306 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-30 16:47:44 +00:00
Boone Gorges
9cb4d3c1ce In get_adjacent_post(), return private post if the current user has the capacity to read it.
This mirrors the check that happens post-query in `WP_Query`. See #30911.

Props bswatson.
Fixes #30287.

git-svn-id: https://develop.svn.wordpress.org/trunk@31302 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-30 02:19:46 +00:00
Boone Gorges
9f8e5d3c17 Add unit tests for 'show_option_all' behavior of wp_list_categories().
See #21881.

git-svn-id: https://develop.svn.wordpress.org/trunk@31301 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-30 01:39:31 +00:00
Boone Gorges
bb0ca6f111 Add tests for get_category_parents().
See #30415.

git-svn-id: https://develop.svn.wordpress.org/trunk@31299 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-29 20:48:03 +00:00
Dion Hulse
db3a49f8c8 HTTP API: Fix an issue where the limit_response_size parameter wasn't working properly with large documents and the cURL transport.
Fixes #31172


git-svn-id: https://develop.svn.wordpress.org/trunk@31290 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-29 03:57:42 +00:00
Boone Gorges
465e66e2cd Add basic unit tests for get_page_of_comment().
See #11334.
Props jeremyfelt.

git-svn-id: https://develop.svn.wordpress.org/trunk@31289 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-29 02:30:22 +00:00
Boone Gorges
2e848072eb Don't use term IDs for array indexes when caching object terms.
Uncached results pulled from `wp_get_object_terms()` are zero-indexed (ie 0,
1, 2...). As a result, `get_the_terms()` was returning a strictly different
array when pulling from the cache and when the cache was empty.

Props joshlevinson.
Fixes #31086.

git-svn-id: https://develop.svn.wordpress.org/trunk@31287 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-28 20:42:25 +00:00
Boone Gorges
a57a612c95 Improve organiation of tax_query and meta_query unit tests.
`meta_query` tests have been moved to `tests/phpunit/tests/query/metaQuery.php` and `tax_query` tests to `tests/phpunit/tests/query/taxQuery.php`. This is an improvement because (a) it better corresponds to the way that other `WP_Query` parameter tests are organized, (b) splitting meta and tax tests into separate classes simplifies the required `@group` annotations, and (c) the tests have nothing to do with posts per se, and so do not belong in the `post` subdirectory.

The tests previously found at `tests/phpunit/tests/query/taxQuery.php` have been moved to `isTerm.php` in the same directory. These tests are related to the `is_*` functions that have to do with taxonomy terms, like `is_category()`.

See #26999.

git-svn-id: https://develop.svn.wordpress.org/trunk@31286 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-27 20:03:50 +00:00
Boone Gorges
9d3a6394fb Ensure that 'hierarchical' is respected in get_terms() when multiple taxonomies are passed.
Previously, attempts to descend the family tree of each term were done using
the first taxonomy in the `$taxonomies` array, with the result that terms not
belonging to that taxonomy were not found and their children not properly
parsed. We fix this bug by fetching each term's taxonomy with the SQL query,
and then using that taxonomy to get the correct children for each term.

Fixes #31118.

git-svn-id: https://develop.svn.wordpress.org/trunk@31285 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-26 19:03:09 +00:00
Boone Gorges
fed49d226c Ensure that 'pad_counts' is not discarded when the first of multiple taxonomies passed to get_terms() is non-hierarchical.
See #31118.

git-svn-id: https://develop.svn.wordpress.org/trunk@31284 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-26 18:08:59 +00:00
Boone Gorges
1eee61f31a Do not run certain cache-hit tests on multisite.
These tests fail on multisite if run after a test that creates
`wpmu_create_blog()`, because `wpmu_create_blog()` defines `WP_INSTALLING`,
which results in unexpected cache misses. See [28965] for a similar fix.

git-svn-id: https://develop.svn.wordpress.org/trunk@31280 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 12:59:00 +00:00
Andrew Nacin
4857c6996c Allow $autoload in add_option() to receive false.
props dllh.
fixes #31119.


git-svn-id: https://develop.svn.wordpress.org/trunk@31278 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 07:50:31 +00:00
Boone Gorges
4e3e98698f In Tests_Ajax_ReplytoComment::test_blocked_comment(), don't stop blocking comments until test is complete.
The test uses the `_block_comments()` method to prevent comment inserts from
happening. Since [31263], failed comment inserts lead to the comment content's
being stripped of invalid characters and inserted again. By immediately
unhooking itself after first being run, `_block_comments()` was causing the
INSERT block to work only for the first attempt, while the second attempt was
going through, causing the test to fail. As a fix, we move the
`remove_filter()` call to the class's `tearDown()` method - sufficient for
cleanup, but late enough that *all* comment inserts will be blocked for the
test method in question.

See #21212.
Since [31263], comment INSERT queries that were pseudo-bl

git-svn-id: https://develop.svn.wordpress.org/trunk@31277 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 03:38:10 +00:00
Boone Gorges
5bcee9e939 In get_terms(), check hierarchy for all $taxonomies before bailing early from 'parent' or 'child_of'.
There is a pre-check in `get_terms()` that prevents an unnecessary database
query if the 'parent' or 'child_of' parameter is not found in the cached term
hierarchy (since a term without an index in the hierarchy cache has no
descendants). Previously, only the first item in the `$taxonomies` array was
being checked, with the result that an empty array was being erroneously
returned in cases where the 'parent' or 'child_of' term is in a subsequent
taxonomy.

See #31118.

git-svn-id: https://develop.svn.wordpress.org/trunk@31276 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-25 02:45:11 +00:00
Boone Gorges
c67e5da8c9 Introduce 'childless' parameter to get_terms().
This new parameter allows developers to limit queried terms to terminal nodes -
ie, those without any descendants.

As part of the improvement, some internal logic in `get_terms()` has been
consolidated. Parameters that resolve to a NOT IN clause containing term IDs
('exclude', 'exclude_tree', and 'childless') are now parsed into a single
"exclusions" array before the SQL clause is generated.

Props theMikeD, horike.
Fixes #29839.

git-svn-id: https://develop.svn.wordpress.org/trunk@31275 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-24 18:47:30 +00:00
Boone Gorges
8ec0792557 Add classes for custom taxonomy terms in get_post_class().
Props sillybean.
Fixes #16223.

git-svn-id: https://develop.svn.wordpress.org/trunk@31271 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-23 15:40:31 +00:00
Boone Gorges
10d3b42211 Introduce 'parent' parameter to wp_get_object_terms().
Props mikeschinkel.
Fixes #15675.

git-svn-id: https://develop.svn.wordpress.org/trunk@31270 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-23 14:56:04 +00:00
Boone Gorges
be28a2c9c5 A few more wordpress.com https assets in unit tests.
See #31091.

git-svn-id: https://develop.svn.wordpress.org/trunk@31259 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:57:17 +00:00
Boone Gorges
cabab6c140 Use https URLs for wordpress.com assets in Tests_HTTP_Functions.
The http->https redirects were breaking some of the tests.

Fixes #31091.

git-svn-id: https://develop.svn.wordpress.org/trunk@31258 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:43:03 +00:00
Boone Gorges
ab551d8dac Move GD-specific resize test to GD-specific resize test file.
This makes it so that we don't have to mark the test as skipped when running
through Imagick tests.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31257 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 18:27:44 +00:00
Boone Gorges
4dd59fd9ce Remove skipped unit tests related to proposed map_deep().
The tests have been added as a patch to #22300.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31256 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-21 17:57:15 +00:00
Boone Gorges
5fdc8a8364 Remove WP_Post_IDs_Iterator tests.
The tests have been moved to a patch on the ticket where the class has been
proposed, #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31254 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 21:59:24 +00:00
Boone Gorges
70eee8514b Remove skipped tests related to the proposed Export API.
These tests have been added as a patch to #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@31253 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 20:57:08 +00:00
Boone Gorges
f1771073dc WP_Date_Query date validation should not fail for hour = 0.
Props ChriCo, tyxla.
Fixes #31067 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31251 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 19:12:48 +00:00
Gary Pendergast
3a87ef36e2 Texturize: Add "em" as a cockney term, so that "'em" is texturized with an apostrophe, instead of an open quote.
Fixes #29813.

Props miqrogroove.



git-svn-id: https://develop.svn.wordpress.org/trunk@31249 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-20 18:43:30 +00:00
Boone Gorges
d80ca82693 Better loop detection for _pad_term_counts().
The `$ancestors` check must be reset for each term in order for term counts
to be correct.

Fixes #20635.

git-svn-id: https://develop.svn.wordpress.org/trunk@31248 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-19 16:51:44 +00:00
Sergey Biryukov
a036114a4d attachment_url_to_postid() should always return an integer.
props nathan_dawson, ashfame.
fixes #31044.

git-svn-id: https://develop.svn.wordpress.org/trunk@31239 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-18 20:32:50 +00:00
Boone Gorges
9501fb3213 Additional 'orderby' values for wp_get_object_terms().
Adds support for ordering by 'taxonomy', 'term_taxonomy_id', and 'parent'.

Props ChriCo.
Fixes #28688.

git-svn-id: https://develop.svn.wordpress.org/trunk@31236 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-18 18:56:38 +00:00
Boone Gorges
68283f5fb3 Add unit tests for 'orderby' and 'order' param of wp_get_object_terms().
git-svn-id: https://develop.svn.wordpress.org/trunk@31233 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 20:38:25 +00:00
Boone Gorges
108e85314b Move wp_get_object_terms() tests into their own file.
See #26999.

git-svn-id: https://develop.svn.wordpress.org/trunk@31230 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 20:08:04 +00:00
Andrew Ozz
f18854e866 Add support for IE conditional comments for WP_Scripts to match the functionality of WP_Styles, including unit tests. Props filosofo, aaroncampbell, ethitter, georgestephanis, valendesigns. Fixes #16024.
git-svn-id: https://develop.svn.wordpress.org/trunk@31223 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-17 01:36:55 +00:00
Boone Gorges
60f2983b2e Bail out of hierarchy loops in _get_term_children().
This prevents infinite loops that lead to PHP nesting limit fatal errors.

Props boonebgorges, sgrant.
Fixes #24461.

git-svn-id: https://develop.svn.wordpress.org/trunk@31207 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 17:09:11 +00:00
Boone Gorges
8ae64f6384 Bail out of hierarchy loops in _pad_term_counts().
Taxonomy hierarchy loops should not occur naturally, but when they do, the
logic of `_pad_term_counts()` could result in infinite loops, leading to
timeouts. We avoid this by breaking when a loop is detected.

Fixes #20635.

git-svn-id: https://develop.svn.wordpress.org/trunk@31206 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 16:45:21 +00:00
Boone Gorges
af146fef8c In paginate_links(), don't override custom format arguments when setting up default 'add_args'.
Since 4.1 [29780], the default value of the 'add_args' argument in
`paginate_links()` has been determined by parsing the current URL. This change
had the side effect of overriding custom values of 'format' that changed the
pagination query var, with the result that plugins using `paginate_links()`
with a custom format generated the incorrect links unless explicitly
declaring 'add_args=false' to prevent the default values from overriding. We
fix this behavior by parsing URL query vars into the 'add_args' array only
after the explicit function params have been parsed, and by skipping the
current page's pagination query var when doing this parsing (to avoid the
override).

Props obenland.
Fixes #30831 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31203 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 15:48:24 +00:00
Gary Pendergast
c8c8b66bae When a hyphen - or double hyphen -- was at the start or the end of a string, it wasn't texturized correctly.
Fixes #31030



git-svn-id: https://develop.svn.wordpress.org/trunk@31199 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 03:54:00 +00:00
Gary Pendergast
58d931dfc7 Allow comment_post_ID to be passed to wp_update_comment(), so that a comment can be moved to a different post.
Props tyxla, rachelbaker

Fixes #30946



git-svn-id: https://develop.svn.wordpress.org/trunk@31195 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 02:38:30 +00:00
Scott Taylor
acbf60c9a6 After [31186], remove figcaption from the list of inline elements that are autop'd in Tests_Formatting_Autop::test_that_wpautop_treats_inline_elements_as_inline().
See #29219.


git-svn-id: https://develop.svn.wordpress.org/trunk@31191 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 01:50:47 +00:00
Scott Taylor
bcc7f9e093 In WP_User, ->get_role_caps() and ->update_user_level_from_caps() must be called inside ->add_cap() and ->remove_cap() after updating user meta. ->has_cap() checks are currently failing directly after calling ->add_cap().
Adds unit test.

Props rachelbaker.
Fixes #28374.


git-svn-id: https://develop.svn.wordpress.org/trunk@31190 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-16 01:48:36 +00:00
Boone Gorges
4b6957c852 Support array values in WP_Date_Query::validate_date_values().
Introduced in [29925], `validate_date_values()` throws `_doing_it_wrong()`
notices when values passed as part of a `WP_Date_Query` do not reflect actual
dates. However, the validation did not account properly for the case where an
array of multiple values is passed, as when doing IN or BETWEEN queries.

Props dlh.
Fixes #31001 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31179 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-14 16:50:09 +00:00
Sergey Biryukov
819a53be46 Add 'user_id' to the list of fields wp_update_comment() can update.
props jphase.
fixes #30307.

git-svn-id: https://develop.svn.wordpress.org/trunk@31172 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-13 06:47:33 +00:00
Sergey Biryukov
a744bb9a5f Add 'comment_type' to the list of fields wp_update_comment() can update.
props desaiuditd.
fixes #30627.

git-svn-id: https://develop.svn.wordpress.org/trunk@31171 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-13 06:41:19 +00:00
Jeremy Felt
0eb9f7e414 Use a less complex approach for enforcing path slashes in update_blog_details()
Ensure leading and traling slashes are in place and don't touch anything in the middle. Validating with `array_filter()` would have missed a possible valid falsy path - `/my-path/0/`.

Props nacin.

Fixes #18117.


git-svn-id: https://develop.svn.wordpress.org/trunk@31158 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 04:20:47 +00:00
Jeremy Felt
d759c0ef23 Check for existence of data from get_blogaddress_by_id() before returning a URL
* Prevent a notice when an invalid ID is used with `get_blogaddres_by_id()`.
* Return a falsy empty string rather than the previous "http://".
* Add unit tests for `get_blogaddress_by_id()`.

Props nerrad.

Fixes #30566.


git-svn-id: https://develop.svn.wordpress.org/trunk@31157 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 02:23:43 +00:00
Jeremy Felt
f9e9287875 Enforce leading and trailing slashes on paths updated with update_blog_details()
In multisite, core expects the stored value for a site's path to have leading and trailing slashes. When these slashes are missing, it becomes impossible to visit the site.

This enforces proper `/path/` creation in `update_blog_details()`, most likely used when updating an existing site through `site-info.php`.

Props earnjam, simonwheatley.

Fixes #18117. Fixes #23865.


git-svn-id: https://develop.svn.wordpress.org/trunk@31155 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 01:42:46 +00:00
Gary Pendergast
69f8b26d89 In get_avatar_data(), there's no need to return false if we couldn't find an avatar, as Gravatar can handle being given an empty email hash. This allows the default avatar to show when no email address is given.
See #21195



git-svn-id: https://develop.svn.wordpress.org/trunk@31153 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 00:19:34 +00:00
Gary Pendergast
d0fab598e7 In get_avatar(), revert the <img> tag attributes to using single quotes, instead of double quotes. This behaviour was changed in [31107], but caused problems for code that attempted to parse the <img> tag.
See #21195



git-svn-id: https://develop.svn.wordpress.org/trunk@31152 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-12 00:02:31 +00:00
Boone Gorges
77128eb048 Default $parent in category_exists() should default to null rather than 0.
[29863] made the corresponding change in `term_exists()`. Failure to change the
default value in `category_exists()` meant that an unspecified value for
`$parent` would limit results to top-level categories.

Includes unit tests and corrected function documentation.

Props hissy.
Fixes #30975 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@31140 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-11 01:25:19 +00:00
Boone Gorges
d5c9eb41d7 In get_permalink(), don't resolve to pretty permalink if post has 'future' status.
We already do this for other non-public statuses, to prevent leaking non-public
information about unpublished posts.

Props e.mazovetskiy, CalEvans.
Fixes #30910.

git-svn-id: https://develop.svn.wordpress.org/trunk@31114 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-09 16:39:56 +00:00
Gary Pendergast
dec1cba410 Add get_avatar_url(), for retrieving just the URL of an avatar, rather than the entire <img> tag that get_avatar() produces.
Unlike `get_avatar()`, `get_avatar_url()` is not pluggable. It can be extended/or modified through the new filters included.

Fixes #21195.

Props mdawaffe, pento, pathawks, DrewAPicture



git-svn-id: https://develop.svn.wordpress.org/trunk@31107 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-09 04:42:48 +00:00
Sergey Biryukov
907be55276 Pass post type to count_user_posts() in get_the_author_posts().
props Caspie, tyxla.
fixes #30904.

git-svn-id: https://develop.svn.wordpress.org/trunk@31098 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 19:52:52 +00:00
Sergey Biryukov
d5b99d560e Use home_url() instead of hardcoded domain in Tests_Link_GetAdjacentPostLink.
props CalEvans.
fixes #30955.

git-svn-id: https://develop.svn.wordpress.org/trunk@31097 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-08 18:44:18 +00:00
Sergey Biryukov
4fdc7c7a0b Don't force newlines around URLs in WP_Embed::autoembed().
props chipx86, sgrant.
fixes #23776.

git-svn-id: https://develop.svn.wordpress.org/trunk@31066 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-07 07:50:58 +00:00
Sergey Biryukov
2fcd588983 Fix typo in a comment in slashing tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@31065 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-07 07:08:47 +00:00
Gary Pendergast
eb4d356e29 size_format() incorrectly included a trailing space for B values: less than 1024 bytes.
Also add a unit test to check for this, so we don't do it again.

Fixes #30908.

Props tillkruess.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@31052 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-05 13:12:06 +00:00
Boone Gorges
969808e7bb Add tests for the 'post_status' behavior of WP_Query.
See #29167.

git-svn-id: https://develop.svn.wordpress.org/trunk@31047 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-04 20:35:12 +00:00
Boone Gorges
04eef529b0 Remove non-built-in post statuses during each unit test teardown.
See #29167.

git-svn-id: https://develop.svn.wordpress.org/trunk@31046 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-04 20:05:53 +00:00
Scott Taylor
3d3e1fb72a Preserve alpha transparency when rotating a PNG while GD is the active image editor.
Adds unit tests.

Props frankpw, voldemortensen.
Fixes #30596.


git-svn-id: https://develop.svn.wordpress.org/trunk@31040 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 22:01:54 +00:00
Scott Taylor
d699ce8b13 Ensure that inline styles attached to conditional stylesheets are also conditional.
Adds unit test.

Props georgestephanis.
Fixes #29180.


git-svn-id: https://develop.svn.wordpress.org/trunk@31031 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 04:09:12 +00:00
Boone Gorges
3da394f499 Add tests for wp_list_categories() CSS class generation.
See #16497.

git-svn-id: https://develop.svn.wordpress.org/trunk@31026 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 02:22:54 +00:00
Boone Gorges
fd8b7faff6 In Walker_Category, don't generate list elements for empty cat names.
This change allows the 'list_cats' filter to be used to suppress certain
items in category lists, without creating invalid or superfluous markup.

Props samo9789.
Fixes #16792.

git-svn-id: https://develop.svn.wordpress.org/trunk@31025 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-03 02:04:17 +00:00
Boone Gorges
4cead42b26 Introduce 'name' parameter for get_terms().
This enhancement requires a modification in the way that `wp_dropdown_categories()`
prepares its arguments for `get_terms()`, so that its unrelated 'name' param is
not mistaken for the new 'name' argument in `get_terms()`.

Props danielbachhuber.
Fixes #30611.

git-svn-id: https://develop.svn.wordpress.org/trunk@31024 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-02 21:33:33 +00:00
Boone Gorges
60a216d587 Add tests for wp_delete_object_term_relationships().
See #30879.

git-svn-id: https://develop.svn.wordpress.org/trunk@31021 602fd350-edb4-49c9-b593-d223f7449a82
2015-01-02 14:02:54 +00:00
Boone Gorges
bd03b2ead8 Support array values for post-related parameters in WP_Comment_Query.
Props nprasath002, c3mdigital, ianmjones.
Fixes #20006.

git-svn-id: https://develop.svn.wordpress.org/trunk@31015 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-31 19:37:09 +00:00
Boone Gorges
f71821dc05 In remove_all_filters(), only remove callbacks that match the $priority parameter.
Props GeertDD, valendesigns.
Fixes #20920.

git-svn-id: https://develop.svn.wordpress.org/trunk@31014 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-31 19:06:29 +00:00
Boone Gorges
be2ea9b9f9 Back up and restore dropins during get_dropins() tests.
This change ensures that the `get_dropins()` tests don't detect any actual
dropins that you might be running on your develop.wordpress installation.

Props valendesigns.
Fixes #30860.

git-svn-id: https://develop.svn.wordpress.org/trunk@31009 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-31 15:00:32 +00:00
Boone Gorges
ae6575685c In wp_dropdown_categories(), allow the term field used to populate option valuesto be specified.
The new 'value_field' parameter makes it possible to set term slugs (or some
other term property) as the 'value' attribute of the option elements generated
by `wp_dropdown_categories()`. This additional flexibility reduces the effort
required to translate term_id to other term fields when processing form
submissions that include values from taxonomy dropdowns. See #30865 for a
use case.

Props collinsinternet.
Fixes #30306.

git-svn-id: https://develop.svn.wordpress.org/trunk@31006 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-30 21:30:16 +00:00
Boone Gorges
e85543f68b When no plugins are active, return an empty array from validate_active_plugins().
This creates parity with the behavior of the function when plugins *are* active,
but none are invalid. It also makes it possible to write unit tests for the
function.

Props sgrant.
Fixes #30860.

git-svn-id: https://develop.svn.wordpress.org/trunk@31003 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-30 19:30:07 +00:00
Boone Gorges
8d2c1bdc72 Improved tests for wp-admin/includes/plugin.php.
- Improved cleanup for existing tests, by ensuring that plugins are deactivated.
- New tests for `get_plugin_files()`, `get_mu_plugins()`, `_sort_uname_callback()`, `get_dropins()`, `is_network_only_plugin()`, `activate_plugins()`, `validate_active_plugins()`, and `is_uninstallable_plugin()`.

Props sgrant.
See #30860.

git-svn-id: https://develop.svn.wordpress.org/trunk@31002 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-30 19:23:49 +00:00
Boone Gorges
8dbce12a61 In Imagick tests, instantiate WP_Image_Editor_Imagick directly instead of calling wp_get_image_editor().
This is for greater consistency with other image editor tests.

Props voldemortensen.
Fixes #30820.

git-svn-id: https://develop.svn.wordpress.org/trunk@30990 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-23 14:34:09 +00:00
Boone Gorges
5f1ad2d768 In wp_update_term(), limit duplicate slug checks to the same taxonomy as the updated term.
In 4.1 [30240], `wp_insert_term()` was modified to allow the creation of terms
with duplicate slugs, as long as the terms are in different taxonomies.
`wp_update_term()` didn't get the corresponding modification, with the result
that term updates fail when the term being updated shares a slug with an older
term, regardless of that older term's taxonomy.

Props ipm-frommen.
Fixes #30780 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@30985 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-22 15:32:59 +00:00
Boone Gorges
fd4231c2a1 Use correct notation for global functions in @covers test annotations.
Props sgrant.
Fixes #30769.

git-svn-id: https://develop.svn.wordpress.org/trunk@30976 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-19 15:20:41 +00:00
Boone Gorges
b824d6f56c Update individual term caches in get_terms().
This was removed in [29915] as part of the attempt to add cache support to
`get_term_by()`. When that support was removed in [30900], it was not properly
restored.

This changeset includes a unit test to verify that the cache is properly primed
for terms found in `get_terms()`, as well as tests to verify the other cache
setting that was touched by [30900].

Fixes #30749. See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30954 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-17 16:38:44 +00:00
Boone Gorges
bf62165353 Remove caching for get_term_by() calls.
The new cache group scheme causes term invalidation to be overly broad, so
that busting the cache for one term will bust the cache for all terms in the
taxonomy. We'll have another go at more focused use of the 'last_changed'
incrementor in a future release.

Reverts [29915], [30073], [30080], [30108], [30112].
See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30900 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-16 13:26:19 +00:00
John Blackbourn
4f35288dd1 Add tests which ensure the wp_editor_set_quality and jpeg_quality filters only apply if they are added before the corresponding WP_Image_Editor is instantiated.
Props DH-Shredder
See #29856


git-svn-id: https://develop.svn.wordpress.org/trunk@30873 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-15 21:24:21 +00:00
Boone Gorges
093de0f0be In WP_Meta_Query, interpret 'value' correctly when used with EXISTS/NOT EXISTS.
As in earlier versions, EXISTS with a value is equivalent to '=', while NOT
EXISTS should always ignore 'value'.

Props barrykooij.
Fixes #30681 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@30846 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-14 19:00:31 +00:00
Jeremy Felt
0ae462657d Clean up factory arguments in ms-sites group.
* Arguments for user, path, and title are only necessary when we need to do something with those arguments later. Most cases in the ms-sites group do not require them.
* In `test_get_blog_id_from_url_is_case_insensitive()`, we should pass a lowercase domain argument.
* A user factory in `test_switch_restore_blog()` is not necessary.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30786 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 02:32:53 +00:00
Jeremy Felt
a4c7261823 Split current tests for update_blog_status()
The current tests for `update_blog_status()` mirrored the tests for `update_blog_details()` in many ways and can be split in the same way. A noticeable difference is that the the matching actions fire even when no change is made to a field.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30785 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 02:14:21 +00:00
Jeremy Felt
7a8bceabaa Split current tests for update_blog_details()
The current tests for `upload_blog_details()` were focused on the actions fired whenever a site is marked as spam, archived, deleted, or matured. This breaks those into individual sections with fewer assertions per test.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30784 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 01:43:31 +00:00
Boone Gorges
98d17497d2 In WP_Query::get_queried_object(), use the new format for referencing tax query clauses.
`queried_terms`, rather than `queries`, is the tax_query property where a flat
index of terms is stored.

See [29901] for a similar fix in `redirect_canonical()`. See #29738.

Props dd32.
Fixes #30623.

git-svn-id: https://develop.svn.wordpress.org/trunk@30771 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-07 14:57:53 +00:00
Mark Jaquith
71bb091cc3 Revert [28719] and no longer math-process multiplication of negative numbers
see #19308
fixes #30445
props rmccue

git-svn-id: https://develop.svn.wordpress.org/trunk@30752 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-06 21:23:12 +00:00
Scott Taylor
e37fb988b1 Give up on making uninterrupted hierarchies work in get_page_children() for now, reverts [30159], [30246], [30636].
Props boonebgorges.
See #14477.


git-svn-id: https://develop.svn.wordpress.org/trunk@30735 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-04 00:23:47 +00:00
Jeremy Felt
6213bb9689 Split tests for get_blog_id_from_url()
Breaks the many assertions for `get_blog_id_from_url()` into individual tests.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30719 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-03 05:51:33 +00:00
Jeremy Felt
a23c468ac8 Split and improve multisite tests for upload quota
Break a single test with many assertions into many tests with single assertions.

In the process, provide separate and comprehensive tests for `upload_is_user_over_quota()`, `is_upload_space_available()`, and `get_space_allowed()`.

Also removes a check for `BLOGSUPLOADDIR`, a constant that never existed. New tests will need to be introduced to handle the ms-files group.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30715 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 22:55:30 +00:00
Gary Pendergast
9528294613 Unit Tests: The test_set_allowed_incompatible_sql_mode() test tries to set the NO_ZERO_DATE sql mode, which was removed in MySQL 5.7. This causes the test to incorrectly fail when run against MySQL 5.7.
git-svn-id: https://develop.svn.wordpress.org/trunk@30704 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 05:11:49 +00:00
John Blackbourn
5cda7d6aed Update the tests for get_metadata() to reflect the revert in r30701.
See #15030


git-svn-id: https://develop.svn.wordpress.org/trunk@30702 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 03:43:17 +00:00
Gary Pendergast
34f8e4d433 WPDB: When looking up the character set for a table or column, make sure we send the table name to MySQL in the correct case, as MySQL can be configured with case sensitive table names.
Fixes #30538.


git-svn-id: https://develop.svn.wordpress.org/trunk@30699 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 02:59:36 +00:00
Boone Gorges
50386cafd5 Use assertEqualSetsWithIndex() as appropriate in get_terms() tests.
See #30522.

git-svn-id: https://develop.svn.wordpress.org/trunk@30688 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 14:24:43 +00:00
Gary Pendergast
897b1645bb Unit Tests: The assertEqualSets() helper was returning true for some sets that were not equal. assertEqualSets() now behaves correctly, and the new assertEqualSetsWithIndex() helper also checks that the array indexes are the same.
Fixes #30522.


git-svn-id: https://develop.svn.wordpress.org/trunk@30687 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 05:01:29 +00:00
John Blackbourn
cedecf8033 Allow brackets in a URL when it's sanitised for a redirect. Brackets are valid in query parameters.
Fixes #30308
Props voldemortensen


git-svn-id: https://develop.svn.wordpress.org/trunk@30684 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 03:20:13 +00:00