Commit Graph

926 Commits

Author SHA1 Message Date
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
Aaron Jorbin 1c68f89686 Add jQuery UI Core as a dependency for qUnit tests
[30919] added more qUnit tests for the Customizer. One of the dependencies for these tests is qUnit. Otherwise we end up with an error due to an unsupported pseudo.

https://travis-ci.org/aaronjorbin/develop.wordpress/jobs/44873635#L425 shows an example of the failing test.

Props ocean90.
see #30701.
Fixes #30754.



git-svn-id: https://develop.svn.wordpress.org/trunk@30989 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-23 00:16:52 +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
Dominik Schilling (ocean90) e7f2ebf414 Customizer: Add more QUnit tests to improve coverage on the new models.
Includes tests for the broken `activate()`/`deactivate()` methods, which were fixed in [30871].

props westonruter.
see #30701.

git-svn-id: https://develop.svn.wordpress.org/trunk@30919 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-16 19:43:22 +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
Dominik Schilling (ocean90) abe2a7ae21 Customizer: Move private helper functions to `wp.customize.utils` so they can be unit tested.
Includes unit tests.

props ryankienstra, westonruter.
see #28709.

git-svn-id: https://develop.svn.wordpress.org/trunk@30716 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 22:55:48 +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
John Blackbourn b57c4ae165 Allow square brackets in a URL when it's sanitised for a redirect. Square brackets are valid in query parameters and IPv6 addresses.
Fixes #17052
Props voldemortensen


git-svn-id: https://develop.svn.wordpress.org/trunk@30683 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 03:15:24 +00:00
Andrew Ozz 45f4403dd0 TinyMCE: update to 4.1.7, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt. Fixes #30560.
git-svn-id: https://develop.svn.wordpress.org/trunk@30675 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 23:27:23 +00:00
Scott Taylor 35708f61f8 Use `round()` instead of `floor()` when resizing image dimensions.
Updates unit tests.

Props SergeyBiryukov, kitchin.
Fixes #18532.


git-svn-id: https://develop.svn.wordpress.org/trunk@30660 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 19:53:18 +00:00
Scott Taylor 653485e87f `wp_upload_dir()` has a (little-known?) side effect: if you call it, it will attempt to create an uploads directory for the current month. As such, `tearDown()` and cleanup routines have to be in sync with this behavior when deleting bogus directories used in unit tests.
Examples: if you clean up directories in a test, or a test fails before the directories are cleaned, or a test fails before the `'upload_path'` option is reset, the next call to `wp_upload_dir()` will recreate the directories you just tried to delete.

These changes ensure that `src/foo` and `/tmp/wp-unit-test` directories are deleted immediately after `wp_upload_dir()` is fired in the tests. 
 
Fixes #30513.


git-svn-id: https://develop.svn.wordpress.org/trunk@30658 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 19:05:52 +00:00
Scott Taylor a411918199 Adjust the RegEx in `wp_check_filetype()` to be aware that query strings are thing that exist sometimes in URLs.
Adds unit tests.

Props voldemortensen.
Fixes #30377.


git-svn-id: https://develop.svn.wordpress.org/trunk@30640 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 06:32:16 +00:00
Scott Taylor b59b9f466a Fix edge-case in media cropping where selection and destination are the same size.
Adds unit tests.

Props mboynes.
Fixes #19793.


git-svn-id: https://develop.svn.wordpress.org/trunk@30639 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 06:26:26 +00:00
Gary Pendergast ea89b1c942 WPDB Unit Tests: Fix a fatal error that occurs in the `test_strip_invalid_text()` test if the `mbstring` extension isn't activated in PHP.
git-svn-id: https://develop.svn.wordpress.org/trunk@30631 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 05:35:00 +00:00
John Blackbourn 76a9abd7a7 Check attachments as well as the current post type when checking for duplicate post slugs. This avoids creating a page with a slug which conflicts with an existing attachment (the inverse is already handled).
Updates the existing test for pages which should take priority over attachments in cases where an existing clash exists.

Fixes #18962
Props boonebgorges


git-svn-id: https://develop.svn.wordpress.org/trunk@30629 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 04:48:54 +00:00
Gary Pendergast c00ba04e9c WPDB: Remove the addition of `STRICT_ALL_TABLES`, added in [30400]. This proved to be incompatible with too many plugins, as well as being incompatible with MySQL 5.7.
See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30587 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-27 10:59:10 +00:00
Boone Gorges fffff63fbe Revert shared taxonomy term splitting for 4.1.
This is a revert of [30494], [30492], [30347], and [30334]. The latter
changeset was a revert of [30336], which was a revert of [30241].

Watch for Term Splitting, Version III in version 4.2, coming soon to a
WordPress trunk near you.

See #30335, #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30585 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-27 00:04:59 +00:00
ocean90 ebfa390ea1 Type cast `$nonce` to string in `wp_verify_nonce()`.
props jesin.
fixes #29542.

git-svn-id: https://develop.svn.wordpress.org/trunk@30576 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-26 19:18:02 +00:00
Gary Pendergast 0cb93dd166 When `json_encode()` returns a JSON string containing `'null'` in PHP 5.4 or earlier, `wp_json_encode()` will now sanity check the data, as older versions of PHP failed to encode non UTF-8 characters correctly, instead returning `'null'`.
Fixes #30471.


git-svn-id: https://develop.svn.wordpress.org/trunk@30561 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 05:00:36 +00:00
Jeremy Felt f1e5edee9a Add basic unit tests for `is_plugin_active_for_network()`
Props rodrigosprimo
Fixes #30491


git-svn-id: https://develop.svn.wordpress.org/trunk@30559 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 04:02:26 +00:00
Boone Gorges 4537217cf1 Add basic unit tests for `is_plugin_active()` and `is_plugin_inactive()`.
Props voldemortensen.
Fixes #30489.

git-svn-id: https://develop.svn.wordpress.org/trunk@30557 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 01:12:39 +00:00
Boone Gorges 7c8c493a9c Fix the unit tests for Imagick alpha.
These tests were written to use the `assertImageAtAlpha()` helper method, whose
internals were specific to GD. As a result, the tests could not pass. This
changeset introduces GD- and Imagick-specific versions of this method.

Props voldemortensen.
Fixes #24871.

git-svn-id: https://develop.svn.wordpress.org/trunk@30549 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 20:56:36 +00:00
Boone Gorges 951409119e Declare an explicit 'order' in `test_get_comments_by_user()`.
This change fixes broken builds on older versions of MySQL. See #30462.

Assertions regarding indeterminate secondary ORDER BY clauses will go in
separate test methods. See #30478.

git-svn-id: https://develop.svn.wordpress.org/trunk@30548 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 14:55:49 +00:00
Gary Pendergast fc2bec7a5e `json_encode()` returns different results for non UTF-8 strings in PHP 5.5+, versus earlier versions of PHP.
This fixes the unit tests that fail in earlier versions, see #30471 for fixing this globally in `wp_json_encode()`.


git-svn-id: https://develop.svn.wordpress.org/trunk@30534 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 01:55:42 +00:00
Gary Pendergast 33dcc948f5 Split the tests for `wp_json_encode()` into smaller chunks (let's all them "units"). Skip a couple of these tests when running on older versions of PHP that don't support the tested functionality.
See #28786.


git-svn-id: https://develop.svn.wordpress.org/trunk@30533 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 23:51:13 +00:00
Boone Gorges b7bcd40bac Remove failing `test_network_limit()` XML-RPC test.
Test added as a patch on #21292.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30530 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 01:22:15 +00:00
Boone Gorges e61c9fecbd Better rewrite rule flushing in `test_permalink_without_title()`.
This ensures that the test is not polluted by permalink structure changes in
earlier tests.

git-svn-id: https://develop.svn.wordpress.org/trunk@30529 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 01:19:04 +00:00
Boone Gorges b44106c380 Ensure that `wpdb_exposed_methods_for_testing` is available to all tests.
It should be defined in a common library file so that all tests have access to
it, even when run in isolation.

See [30345], #21212.

git-svn-id: https://develop.svn.wordpress.org/trunk@30528 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 00:46:50 +00:00
Boone Gorges 4992fdb95f Ensure `sanitize_user()` expected test values are lowercase on multisite.
[30524] neglected to account for the fact that multisite forces user logins to
lowercase.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30527 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 21:29:40 +00:00
Boone Gorges 96f9d84dba Stop checking Trac to skip tests against open tickets.
In general, skipped tests should live only in patches, which are committed at
the same time that the corresponding bug is fixed. In cases where it's
necessary to skip a test, use `markTestSkipped()` to declare this fact
explicitly.

We continue to check Trac when using `WP_UnitTestCase` to run non-core tests.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30526 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 21:10:12 +00:00
Boone Gorges ed426ef8ef Repair the `seems_utf8()` tests that use Big5 encoding.
* Provide sample data that is actually encoded in Big5.
* Do some actual assertions against that data.

Props akumria.
Fixes #30455.

git-svn-id: https://develop.svn.wordpress.org/trunk@30525 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:56:23 +00:00
Boone Gorges 9b6563f70f Remove failing test related to the 'offset' param of `WP_Query`.
This test has been added as a patch to #18897.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30524 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:45:58 +00:00
Boone Gorges 83a9ac46fe Remove failing test related to `wp_list_pages()`.
The test has been added as a patch to #27326.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30523 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:43:56 +00:00
Boone Gorges 086d0311fa Remove failing test related to `wp_unique_post_slug()`.
The test has been added as a patch to #18962.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30522 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:41:04 +00:00
Boone Gorges e102a22f80 Remove failing `is_textdomain_loaded()` test.
The removed test has been added as a patch to the original ticket, #21319.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30521 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:36:51 +00:00
Boone Gorges 05336f904f Remove failing assertions from `is_serialized()` tests.
They have been moved to new test methods, which have been attached as a patch
to the ticket #9930.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30520 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:34:15 +00:00
Boone Gorges 28b45922d5 Remove failing test in the `hooks` group.
The removed test has been added as a patch to #21169.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30519 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:25:03 +00:00
Boone Gorges 63f6864a9e Remove skipped tests for `WP_Export_Query`.
These tests have been added as a patch to the ticket where the new
functionality was originally proposed, #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30518 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:22:01 +00:00
Boone Gorges 0b9a21b451 Remove skipped tests for unimplemented JS plural functions.
The tests have been added as a patch for the original ticket, #22229.

Props MikeHansenMe.
See #22229.

git-svn-id: https://develop.svn.wordpress.org/trunk@30517 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:11:10 +00:00
Boone Gorges d5b277e6bd Remove failing test for unimplemented `wp_mail()` enhancement.
The removed test has been added as a patch to the original ticket, #15448.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30516 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:05:34 +00:00
Boone Gorges 73ef6bd6fc Improvements to encoded character formatting tests.
In `sanitize_title_with_dashes()` and `sanitize_user()` tests, we break large
test methods into smaller ones in order to isolate those that actually describe
the bug being reported in ticket #10823. The unit tests that are continuing to
fail have been attached as a patch to that ticket.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30515 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 19:53:37 +00:00
Boone Gorges 3818c645c3 Remove failing tests related to square brackets being stripped in URL sanitizers.
These tests have been added as a patch to their original ticket, #16859.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30514 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:39:38 +00:00
Boone Gorges f0b8424483 Remove failing tests related to `WP_User::__unset()`.
These tests have been added as a patch to their original ticket, #20043.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30513 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:36:00 +00:00
Boone Gorges fa76c19ecb Declare user_email when setting up fixtures for `count_user_posts()` tests.
Because `setUpBeforeClass()` is called statically and creates its own factory
object, the iterator logic from previous tests is not carried over to these
fixtures, and we risk the possibility of user_email clashes when the tests are
run in certain limited configurations.

git-svn-id: https://develop.svn.wordpress.org/trunk@30512 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:04:07 +00:00
Boone Gorges cfeae751a0 Improve performance of post revision order test.
`test_revision_order()` was written ([28541], #26042) to ensure that revision
order was properly preserved in two different cases: (1) where the post_date
varied (in which case the revisions would be sorted by post_date DESC) and
(2) where the post_date was the same (in which case sorting would fall back on
ID DESC). In an attempt to ensure that both of these scenarios arose in the
context of a single test, 100 posts were created. We can make the process far
more efficient by manually creating the revisions with the post_dates
explicitly declared, and splitting the two different cases into two separate
test methods.

This test was previously the single worst offender in the entire suite, taking
upwards of 15 seconds to run. All that most maddens and torments; all that stirs
up the lees of things; all truth with malice in it; all that cracks the sinews
and cakes the brain; all the subtle demonisms of life and thought; all evil, to
crazy Boone, were visibly personified, and made practically assailable in
`test_revision_order()`.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30511 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 14:17:21 +00:00
Boone Gorges 36315d2b3f Remove some failing unit tests from the `post` group.
These tests have been added as a patch to ticket #19373.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30510 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 12:03:48 +00:00
Sergey Biryukov 917a469052 Replace invalid use of ltrim() in attachment_url_to_postid() with substr().
props bradyvercher.
fixes #30346.

git-svn-id: https://develop.svn.wordpress.org/trunk@30501 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-21 06:34:23 +00:00
Boone Gorges 5e71d5f21e Improve cleanup of cached term_ids after shared terms are split.
* If the split term ID is stored as 'default_category', 'default_link_category', or 'default_email_category', update it to the new ID.
* If the split term ID is associated with a nav menu item, update that piece of postmeta to the new ID.

Props mboynes.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30494 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-21 03:16:08 +00:00
John Blackbourn 8fe059d426 Correct an SQL syntax error introduced in r30158. Adds tests.
Fixes #30339
See #18962
Props julien731


git-svn-id: https://develop.svn.wordpress.org/trunk@30480 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:45:48 +00:00
Andrew Nacin 95dbca94e1 More tests for [30466]. props xknown.
git-svn-id: https://develop.svn.wordpress.org/trunk@30471 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:10:24 +00:00
Andrew Nacin aec2f2654e Prevent high resource usage when hashing large passwords. props mdawaffe, pento
git-svn-id: https://develop.svn.wordpress.org/trunk@30466 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:02:55 +00:00
Andrew Nacin fb28a78331 Anchor texturize to shortcodes to improve regex efficiency.
props miqrogroove.
see #29557 for segfault issues.


git-svn-id: https://develop.svn.wordpress.org/trunk@30449 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 14:27:08 +00:00
Andrew Nacin d2b4df2d4f Invalidate password keys when a user's email changes.
git-svn-id: https://develop.svn.wordpress.org/trunk@30430 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 13:39:03 +00:00
Jeremy Felt 3223d4a4b3 Prevent wpmu_delete_blog from removing the wrong uploads directory
`wp_upload_dir()` includes some logic to fall back to the default site's upload directory if a specific directory for the requested site cannot be found. Because of this, if `wpmu_delete_blog()` is fired twice in a row for the same site, the main site's upload directory could be deleted as well.

This adds some checks in `wpmu_delete_blog()` so that we are confident in the site and it's upload directory's existence before dropping the site. Tests are added for when `ms_files_rewriting` is enabled or disabled.

Fixes #30121


git-svn-id: https://develop.svn.wordpress.org/trunk@30404 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 06:52:07 +00:00
Boone Gorges 10b611b0c3 Return an empty array from `get_approved_comments()` when `$post_id` is empty.
This behavior was broken when moving the internals to `WP_Comment_Query` in
[30098]. As a result, `get_approved_comments( 0 )` was fetching *all* approved
comments, causing performance issues.

Props dd32.
Fixes #30412.

git-svn-id: https://develop.svn.wordpress.org/trunk@30402 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:51:38 +00:00
Gary Pendergast 78f496f378 Fix a MySQL warning in the `test_get_adjacent_post_exclude_self_term` unit test, caused by [30400].
See #21212, #22112.


git-svn-id: https://develop.svn.wordpress.org/trunk@30401 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:47:30 +00:00
Gary Pendergast cabcace53c WPDB: Force `STRICT_ALL_TABLES` to be enabled as soon as we connect to the MySQL server.
This improves data integrity when inserting and updating rows in the database, particularly when trying to insert emoji into posts stored with character sets that don't support emoji.

See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30400 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:45:10 +00:00
Andrew Ozz 7137f26a5b TinyMCE: update to the latest dev. version, 4.1.6+. Fixes #30411.
git-svn-id: https://develop.svn.wordpress.org/trunk@30397 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 00:49:38 +00:00
Boone Gorges c002bcf27e Better test method name in formatting/IsEmail.php.
Props dlh.
Fixes #30397.

git-svn-id: https://develop.svn.wordpress.org/trunk@30392 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-19 19:31:17 +00:00
Boone Gorges d1e841c03b Improvements to `wp_make_link_relative()`.
* Support relative URL input.
* When the URL being made relative has another URL as a parameter, don't make the second URL relative.

Props voldemortensen.
Fixes #30373.

git-svn-id: https://develop.svn.wordpress.org/trunk@30383 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-19 01:52:57 +00:00
Gary Pendergast de33d35d1f WPDB: When a `db.php` drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.
See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30375 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-18 03:37:23 +00:00
Boone Gorges db2bd39770 Add unit test files mistakenly excluded from [30085].
See #9256, #25349.

git-svn-id: https://develop.svn.wordpress.org/trunk@30367 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-17 16:16:01 +00:00
Boone Gorges 69a167688e Flush cache for newly created term in `_split_shared_term()`.
The term itself does not have any cached values yet, but in some cases the new
term's taxonomy may need its cached hierarchy to be refreshed as a result of
the term splitting.

Props jorbin.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30347 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:52:23 +00:00
Gary Pendergast e1ca159011 If a saving a post fails, remove any invalid characters (such as emoji) from the primary text fields, then try to save it again.
See #21212.



git-svn-id: https://develop.svn.wordpress.org/trunk@30346 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:33:50 +00:00
Gary Pendergast 6df14c1612 When creating a post containing emoji, the post can be saved incorrectly if MySQL isn't using a character set that supports emoji.
This change prevents the save from occurring, so it can be handled correctly in the UI.

See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30345 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:27:17 +00:00
Boone Gorges ab96cf6614 Reinstate term splitting on term update.
Originally introduced in [30241] and reverted in [30336], term splitting is
back and better than ever. Now with *more unit tests* and *improved treatment
of child terms*!

See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30344 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:26:48 +00:00
Aaron Jorbin b94dd6a7ec When asserting microtime output as a number, make it a number
microtime is by default a string. Doing a greater then or less than check of that string is a bad idea since it uses the first part (the micro part of microtime) rather then the actual time. This adds a helper to convert microtime output into a float which we can then use to properly compare the output of microtime.

This fixes an intermittent test failure.

fixes #30336



git-svn-id: https://develop.svn.wordpress.org/trunk@30337 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 22:03:15 +00:00
boonebgorges 805021f406 Don't split shared terms on term update.
Splitting shared terms means assigning a new term_id to a given term_taxonomy_id.
It was uncovered that this change could cause problems for sites that have
cached the original term_id somehow - say, in postmeta - since future lookups
using that term_id will now fail.

Removing for 4.1-beta1. We'll look at improvements to backward compatibility
to try to get this back into a later beta.

Props mboynes.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30336 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 20:04:02 +00:00
Boone Gorges 3544e20e9a Introduce `$post_type` param for `count_user_posts()`.
Props Caspie, engelen, DrewAPicture.
Fixes #21364.

git-svn-id: https://develop.svn.wordpress.org/trunk@30322 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 02:18:30 +00:00
Boone Gorges f5d88c355e Manually delete fixture in `test_mysqli_flush_sync()`.
This test creates a dummy post and subsequently runs a query containing
`DROP PROCEDURE`. This latter query implies a `COMMIT`, which means that the
post is not cleaned up for later tests. Manually deleting the post with
`wp_delete_post()` solves this problem.

Fixes #28155.

git-svn-id: https://develop.svn.wordpress.org/trunk@30320 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 01:59:49 +00:00
Boone Gorges df11fb8593 Exclude external-http tests when running `phpunit`.
The external-http tests are very slow, and `Wp_Http` functionality is fairly
isolated, so the benefits of skipping these tests by default outweigh the
risks.

A `grunt phpunit:external-http` subtask has been added, to ensure that the
tests are executed during exhaustive runs of the test suite, such as in
continuous integration.

Fixes #30304.

git-svn-id: https://develop.svn.wordpress.org/trunk@30298 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 14:48:28 +00:00
Gary Pendergast 4b1aa89206 `wpdb::flush()` was not flushing results correctly when using mysqli.
This change also allows stored procedures or queries made with `mysqli_multi_query()` to be flushed.

Includes unit tests.

Fixes #28155.

Props soulseekah.


git-svn-id: https://develop.svn.wordpress.org/trunk@30297 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 05:39:50 +00:00
Boone Gorges 3c360968ef Fix PHP notice in `Tests_Feed_RSS2::test_items()`.
A notice was being thrown when `get_the_tags()` returned false, and `foreach()`
was run over that return value.

See [30283].

git-svn-id: https://develop.svn.wordpress.org/trunk@30295 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 02:04:22 +00:00
Aaron Jorbin 218924d9ee Remove failing Unbalanced tags tests
Patch with tests added to #6297 for use in the future

Props MikeHansenMe for creating patch of current unit test

see #30284


git-svn-id: https://develop.svn.wordpress.org/trunk@30291 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 23:14:28 +00:00
Aaron Jorbin 44825185f7 Remove failing shortcode unit tests
Test added to #14050 in case we want to include it in a future fix.

see #30284



git-svn-id: https://develop.svn.wordpress.org/trunk@30290 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 22:50:30 +00:00
Aaron Jorbin e7e27c2e4d Remove failing uploadfile test in trunk
The test has been added to #11946 and can be readded when that ticket is fixed.

Props MikeHansenMe for creating patch of current unit test

See #30284



git-svn-id: https://develop.svn.wordpress.org/trunk@30289 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:55:41 +00:00
Jeremy Felt 211c7ac373 Move tests for ms_files_rewriting to separate group, ms-files
When the `ms_files_rewriting` flag is enabled, `ms_upload_constants()` is required to properly set upload directory constants. Once this fires, it is impossible to clean up for a non `ms_files_rewriting` test by turning the option back off.

Excluding these tests by default offer a more consistent environment overall. Any tests written for uploaded files in multisite should ideally have a correspondign test in this area.

This commit also moves existing `ms_files_rewriting` tests for `test_switch_upload_dir()`.

Fixes #30256


git-svn-id: https://develop.svn.wordpress.org/trunk@30286 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:07:05 +00:00
Boone Gorges ffcfc0573b Remove failing test related to post galleries.
It relied on the old _WPDataset technique, which is no longer used.

The test has been added to #UT30 as a patch, in case anyone wants to make
future use of it.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30285 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:01:39 +00:00
Boone Gorges 9b425eb5e4 Improve `Tests_Feed_RSS2::test_items()`.
* Better reference to post author, to avoid PHP notices.
* Code styling.
* More reliable checking of tags and categories.

Props kurtpayne.
Fixes #UT32. See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30283 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:54:06 +00:00
Boone Gorges 13602b566d Remove failing unit tests from 'canonical' group.
Each removed test has been turned into a patch and posted to the open ticket
that it belongs to.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30282 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:36:27 +00:00
Jeremy Felt bcf340ff65 Use `remove_added_uploads()` in `tearDown()` for XMLRPC tests
This cleanup avoids false test failures due to incrementing filenames in the uploads directory.

Fixes #30290


git-svn-id: https://develop.svn.wordpress.org/trunk@30279 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:17:17 +00:00
Boone Gorges 608084a9cc In unit tests, use `wpmu_delete_user()` to delete users when `is_multisite()`.
`wp_delete_user()` doesn't remove the user from the database, which causes all
sorts of problems in certain cases.

Props jeremyfelt.
See [30277], #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30278 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 19:55:05 +00:00
Boone Gorges d63ceb08a3 Share fixtures across 'canonical' automated tests.
Sharing these fixtures results in a speed improvement of almost one minute per
run of the test suite.

My hope is that future WordPress developers will spend this extra minute with
their loved ones, for life on this earth is short, my friends, and the moments
you spend watching WP generate test data can never again be reclaimed from the
grizzled clutches of Time, and none of us are really getting younger, I mean,
geez, have you looked in the mirror lately, Gandalf?

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30277 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 19:28:12 +00:00
Boone Gorges fe726039bd Share fixtures across a number of query-related test classes.
This shaves 10-20 seconds off the running time for the suite.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30276 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 15:29:31 +00:00
Boone Gorges f12b0f9aad Correct variable name in `WP_UnitTestCase::temp_filename()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@30268 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-07 01:36:05 +00:00
Boone Gorges 73eee04d38 Unset the default permalink structure after installing Multisite for automated tests.
Most of our unit tests that involve permalinks expect non-pretty permalinks;
this is the default setting for WP. However, when the test suite installs
multisite, `populate_network()` is run before WP recogizes itself as multisite,
which leads to pretty permalinks being set. This breaks a number of unit
tests in ways that are difficult to trace.

git-svn-id: https://develop.svn.wordpress.org/trunk@30267 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-07 01:24:19 +00:00
Boone Gorges b09103c101 Use `assertEqualSets()` for some `WP_Comment_Query` tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@30266 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 22:27:34 +00:00
Boone Gorges 642e826cd9 Don't force child_of=0 for non-hierarchical taxonomies in `get_terms()`.
This forcing appears to have been introduced to save unnecessary queries, but
(a) in some cases it appeared to be causing *more* queries, and (b) it caused
incorrect results when the 'exclude_tree' param of `get_terms()` called
`get_terms()` on each item in the tree using the 'child_of' param.

Fixes #30275.

git-svn-id: https://develop.svn.wordpress.org/trunk@30265 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 21:46:18 +00:00
Boone Gorges 11843fe460 Add tests for `get_adjacent_post_link()` wrappers.
Props MikeHansenMe.
See #29663.

git-svn-id: https://develop.svn.wordpress.org/trunk@30264 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 20:16:10 +00:00
Boone Gorges 6f7880bcf4 In `get_adjacent_post()`, `$excluded_terms` should check term_id rather than term_taxonom_id.
See #29663, #22112.

git-svn-id: https://develop.svn.wordpress.org/trunk@30263 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 20:11:34 +00:00
Boone Gorges 328de7115a Split shared taxonomy terms during 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.

Note that this term splitting only occurs on installations whose database
schemas have been upgraded to version 30133 or higher. Note also that shared
terms are only split when run through `wp_update_term()`, as on edit-tags.php;
we will wait until a future release of WordPress to force the splitting of all
shared taxonomy terms.

Props boonebgorges, rmccue, greuben, garyc40, wonderboymusic, imath, jesin.
Fixes #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30241 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-05 02:02:48 +00:00
Boone Gorges 88167ddc1a Do not create shared taxonomy terms.
A "shared" term occurs when two entries in the `wp_term_taxonomy` table share a
single `term_id`, and thereby correspond to the same row in `wp_terms`. This
changeset stops the practice of creating shared terms: each new row in
`wp_term_taxonomy` will receive its own row in `wp_terms`. The new strategy
for term creation depends on whether the installation's database schema is up
to date for 4.1:

* If so, terms are allowed to be created with the same slug as an existing term, as long as they are in different taxonomies and do not share a parent. Thus, a new tag with the slug 'wordpress' can exist alongside a category with the slug 'wordpress'.
* If not, new terms will be forced to have unique slugs. Thus, on an installation containing a category with the slug 'wordpress', a new tag 'WordPress' will get the slug 'wordpress-2'.

Fixes #21950. See #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30240 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-05 01:41:58 +00:00
Boone Gorges 9c13546518 Introduce `term_template` param to `get_the_taxonomies()`.
This parameter allows theme and plugin authors to specify the formatting they
would like on the term links as they are parsed into the taxonomy list.

Props hereswhatidid, dlh, davidjlaietta.
See #27238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30209 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 18:48:42 +00:00
Boone Gorges 2b6df5f8ce Ignore case when checking string 'false' in `wp_validate_boolean()`.
Props TobiasBg, kitchin.
Fixes #30238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30207 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 15:54:42 +00:00
Boone Gorges 1219355f2b Add unit tests for `wp_validate_boolean()`.
Props TobiasBg.
See #30238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30206 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 15:51:11 +00:00
Boone Gorges f744ee189e In `in_object_in_term()`, only check numeric string values against term_id.
The previous `in_array()` check was playing too loose with mixed types, such
that a string like '10_term_name' would incorrectly match a term_id 10.

Props nobinobi, realloc.
Fixes #29467.

git-svn-id: https://develop.svn.wordpress.org/trunk@30205 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 14:24:23 +00:00
Boone Gorges fc8da37358 Add some unit tests for `is_object_in_term()`.
These tests check a number of the ways that different kinds of values for
`$terms` (integers that match term_id, strings that match term_id or name or
slug) are handled.

See #29467.

git-svn-id: https://develop.svn.wordpress.org/trunk@30204 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 14:24:17 +00:00
Jeremy Felt 6f88946089 Improve layout of test for cached invalid, then valid site details
* Rename method to `test_get_blog_details_when_site_does_not_exist()`.
* Always assume `MAX(blog_id)` is 1 and therefore always create a burner.
* Remove tests specific to `wpmu_delete_blog()` and cache, to be handled elsewhere.
* Remove extra asertions.

See #30080, #23405


git-svn-id: https://develop.svn.wordpress.org/trunk@30175 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-02 01:04:47 +00:00
Jeremy Felt 85aa2ef76e Split tests for wp_get_sites()
Test various arguments for `wp_get_sites()` in a more intentful way rather than in one large test. Leave tests for limit and offset together for convenience.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30174 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 23:39:22 +00:00
Scott Taylor 9817ecd92e Remove failing unit test after [30090].
Fixes #30194.


git-svn-id: https://develop.svn.wordpress.org/trunk@30160 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 21:10:23 +00:00
Scott Taylor 4315c9c5c3 Allow `get_pages()`, with `child_of` passed to it, to work with interrupted hierarchies.
Adds unit test.
Fixes #18962.


git-svn-id: https://develop.svn.wordpress.org/trunk@30159 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 20:43:55 +00:00
Scott Taylor 59658c6547 All duplicate slugs across different post types.
Adds unit test.

Props mboynes, nacin.
Fixes #18962.


git-svn-id: https://develop.svn.wordpress.org/trunk@30158 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 20:36:23 +00:00
Jeremy Felt db68b57c14 Split tests for is_main_site()
Break multiple assertions from one method into multiple methods with one assertion each.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30152 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 05:17:17 +00:00
Jeremy Felt d0fa387002 Expand and clarify tests for get_blog_post()
Remove unnecessary user factory use. Be explicit about test scenarios.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30151 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 04:47:00 +00:00
Boone Gorges 262150a91e Clean up 'post-thumbnail' theme support unit tests.
* Separate into smaller test methods.
* Remove incorrect tests. A number of assertions in the existing test have always incorrectly described the behavior of `current_theme_supports( 'post-thumbnails' )`, but no one ever noticed because the tests had been designed to bail when `_wp_render_title_tag()` did not exist. The failures finally became visible when that function was introduced in [30074].

See #18548.

git-svn-id: https://develop.svn.wordpress.org/trunk@30148 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 04:00:59 +00:00
Boone Gorges 7c64b3b3dd Introduced `dayofweek_iso` time param for `WP_Date_Query`.
The initial `dayofweek` param sets day 1 to Sunday. This is out of step with
ISO standards, which calls Monday day 1. To maintain backward compatibility
with the existing parameter, we introduce the new `dayofweek_iso` for the
new, more compliant param.

Props mboynes.
Fixes #28063.

git-svn-id: https://develop.svn.wordpress.org/trunk@30142 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 03:23:15 +00:00
Boone Gorges d6b7b7aa41 Allow resource_type to be specified in `get_ancestors()`.
Being explicit about resource type (taxonomy vs post_type) allows for the
proper resolution of conflicts when a taxonomy and post_type share a slug.

Props filosofo.
Fixes #15029.

git-svn-id: https://develop.svn.wordpress.org/trunk@30141 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 02:57:31 +00:00
Boone Gorges 8dbaaf9927 Pass all updated meta IDs to filters in `update_metadata()`.
Props wonderboymusic.
Fixes #11683.

git-svn-id: https://develop.svn.wordpress.org/trunk@30140 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 02:38:19 +00:00
Scott Taylor bdf61ef6a0 Fix failing unit tests after [30096]: use `assertEqualSets()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@30135 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 01:10:39 +00:00
Scott Taylor ff4f545fc9 [28785] introduced a bug, where encoded query arguments were decoded by `parse_str()` inside of `wp_parse_str()` but never re-encoded later on.
This encodes them, adds unit test.

Props obenland.
Fixes #29636.


git-svn-id: https://develop.svn.wordpress.org/trunk@30133 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 00:53:26 +00:00
Scott Taylor ef23aee2a6 Fix unit test for video shortcode after [30082].
Fixes #30078.


git-svn-id: https://develop.svn.wordpress.org/trunk@30132 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 00:48:32 +00:00
Boone Gorges be87d5daad Move `term_exists()` tests to their own file.
git-svn-id: https://develop.svn.wordpress.org/trunk@30118 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 18:52:37 +00:00
Boone Gorges 9a84da90c3 Unserialize `get_metadata()` results when 'key' is omitted.
Props mattkeys, nacin.
Fixes #15030.

git-svn-id: https://develop.svn.wordpress.org/trunk@30115 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 10:24:22 +00:00
Jeremy Felt cdc35000f9 Improve tests for domain_exists()
* Split existing tests for `domain_exists()` into many smaller tests.
* Make slightly fewer, more accurate assertions.
* Remove unnecessary site creation via factory.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30114 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 05:43:31 +00:00
Boone Gorges f59f32104a Streamline some `get_terms()` cache tests.
* Split large method into a number of smaller tests.
* Create fewer fixtures.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30113 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 04:15:03 +00:00
Boone Gorges df5e0a00b8 Clean up cache invalidation suspension global in unit tests.
This fixes a test that was introduced in [30073] which was polluting later
tests.

See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30112 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 04:14:53 +00:00
Boone Gorges 6a7443671b Clean up `get_term_by()` caching.
* Fix cache key/group modification that was missed in [30073].
* Update unit tests to reflect new key/group format.

Props tollmanz.
Fixes #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30108 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 02:49:51 +00:00
Boone Gorges cf1d77c101 In `get_terms()`, do not override 'hierarchical' and 'pad_counts' when 'parent' is present.
The previous behavior resulted in descendant terms being improperly excluded
from the results when passing a 'parent', even when 'hierarchical' had been
set to true.

The patch also adds unit tests that demonstrate the various interactions
between the 'child_of', 'parent', and 'hierarchical' parameters of `get_terms()`.

Props landakram.
Fixes #29815.

git-svn-id: https://develop.svn.wordpress.org/trunk@30107 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 02:11:56 +00:00
Jeremy Felt 2988aa8ba7 Expand tests around wpmu_delete_blog()
* Test cache after a site is deleted or flagged as deleted.
* Test tables after a site is deleted or flagged as deleted.
* Test tables and cache after the main site is deleted.
* Test site count after a site is deleted or flagged as deleted.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30106 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 01:59:02 +00:00
Dominik Schilling (ocean90) 90182015e7 Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.

https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.

props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.



git-svn-id: https://develop.svn.wordpress.org/trunk@30102 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 22:50:21 +00:00
Boone Gorges f9e32aef2d Use `WP_Comment_Query` to query comments in `get_approved_comments()`.
Props dancameron.
See #12668.

git-svn-id: https://develop.svn.wordpress.org/trunk@30098 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 21:57:07 +00:00
Boone Gorges bd795a3d16 Better flexibility for 'type' in `WP_Comment_Query`.
* Add support for an array of values in 'type'.
* Introduce `type__in` parameter. This duplicates 'type' but is added for better consistency with other query classes.
* Introduce `type__not_in`.

Among other things, these changes will make it easier for plugin authors to
manage the appearance of custom comment types in various WP interfaces.

Props dancameron, mordauk.
See #12668.

git-svn-id: https://develop.svn.wordpress.org/trunk@30096 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 21:49:08 +00:00
Konstantin Kovshenin 6debe759a6 Use a nested meta query when querying by role in `WP_User_Query`.
If a user query includes a meta query together with a role argument,
nest the original meta query and append the role meta query with an
AND relationship.

fixes #23849, #27026.


git-svn-id: https://develop.svn.wordpress.org/trunk@30094 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 21:40:04 +00:00
Boone Gorges 555d7347f9 Support an empty string passed as a status in `WP_Comment_Query`.
The changes in [30084] broke backward compatibility with interfaces that
manually passed an empty string for the value of 'status', such as on
wp-admin/edit-comments.php.

Fixes #29612.

git-svn-id: https://develop.svn.wordpress.org/trunk@30093 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 19:50:31 +00:00
Boone Gorges 114c1f32ba Improve global variable setting in `setup_postdata()`.
`setup_postdata()` is responsible for setting a number of global variables
that are used for post pagination (`$pages`, `$page`, `$nextpage`) and the
generation of post excerpts (`$more`). These variables should be sensitive to
the currently running instance of `WP_Query` - rather than the main query -
so that these features work properly inside of secondary `WP_Query` loops.

This changeset moves the logic of `setup_postdata()` into a method on `WP_Query`,
and converts `setup_postdata()` to a wrapper.

Props boonebgorges, wonderboymusic.
See #25349.
Fixes #9256, #20904.

git-svn-id: https://develop.svn.wordpress.org/trunk@30085 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 02:31:37 +00:00
Boone Gorges 7c4aada4a6 Support multiple 'status' values in `WP_Comment_Query`.
This change required turning the SQL concatenation into the generation of an
array, for greater flexibility.

Props karpstrucking, ebinnion.
Fixes #29612.

git-svn-id: https://develop.svn.wordpress.org/trunk@30084 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-29 02:21:10 +00:00
Boone Gorges 66e02d639e Remove call to `wp_get_last_changed()` from unit tests.
This function was removed in [30073].

See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30080 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-28 22:02:59 +00:00
Gary Pendergast 0e68ecc0b6 Add `wp_json_encode()`, a wrapper for `json_encode()` that ensures everything is converted to UTF-8.
Change all core calls from `json_encode()` to `wp_json_encode()`.

Fixes #28786.



git-svn-id: https://develop.svn.wordpress.org/trunk@30055 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-28 18:34:16 +00:00
Boone Gorges 6df24465f4 Introduce `orderby=include` support for `get_terms()`.
Props wpsmith.
Fixes #23261.

git-svn-id: https://develop.svn.wordpress.org/trunk@30052 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-28 18:12:30 +00:00
Boone Gorges c6de5dfec5 Allow 'slug' param of `get_terms()` to accept an array.
Props jfarthing84, dlh.
Fixes #23636.

git-svn-id: https://develop.svn.wordpress.org/trunk@30042 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-28 14:56:33 +00:00
Sergey Biryukov cd89f18427 Update expected results in wp_link_pages() unit tests after [30030].
see #24940.

git-svn-id: https://develop.svn.wordpress.org/trunk@30035 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-27 01:58:17 +00:00
Boone Gorges ae0ae95be6 Improve `WP_Tax_Query` param sanitization for empty strings.
When an empty string is passed as one of the clauses in the `$tax_query`
parameter, it should be discarded rather than parsed as a first-order clause.

Props tmtrademark.
Fixes #30117.

git-svn-id: https://develop.svn.wordpress.org/trunk@30031 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-26 22:56:36 +00:00
Boone Gorges 4482d000ba Fix 'count' in `WP_Comment_Query` when using 'meta_query'.
Props heshiming, desaiuditd.
Fixes #23369.

git-svn-id: https://develop.svn.wordpress.org/trunk@30026 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-26 16:45:37 +00:00
Boone Gorges 1345fdbe22 Streamline `WP_User_Query` unit tests.
* Don't create user during setUp(), as it's not used in every test.
* Create fewer users in `get_all` and `orderby` tests.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30017 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 19:51:01 +00:00
Boone Gorges 1fe9707760 Accept 'orderby=include' in `WP_User_Query`.
This lets the results of a user query be sorted manually by the value of the
'include' param.

Props jipmoors.
Fixes #30064.

git-svn-id: https://develop.svn.wordpress.org/trunk@30016 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 19:50:53 +00:00
Boone Gorges b450eb023f Improve unit tests for `WP_User_Query` include param.
git-svn-id: https://develop.svn.wordpress.org/trunk@30008 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 12:18:44 +00:00
Jeremy Felt 5015f3ed4e Improve tests for get_blog_id_from_url()
Expand tests to cover additional cache and lookup scenarios. Explicitly test the reaction of `get_blog_id_from_url()` when `$drop = false` is passed to `wpmu_delete_blog()`. See #30080

Fixes #30088


git-svn-id: https://develop.svn.wordpress.org/trunk@30007 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 05:30:14 +00:00
Jeremy Felt 98a37894d6 Begin cleanup of ms-sites group unit tests
* Split `test_create_and_delete_blog()` into two tests.
* Clean up number of sites created during tests.
* Remove test_getters(), move get_blog_address_by_name() test to `test_created_site_details()`

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30006 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 04:50:57 +00:00
Boone Gorges 382871ad9d Allow ORDER BY in `WP_Comment_Query::query()` to be disabled.
Disable ORDER BY by passing boolean false, an empty array, or the string
'none' to the 'orderby parameter. This mirrors the behavior of `WP_Query`.

Props psycleuk.
Fixes #29902.

git-svn-id: https://develop.svn.wordpress.org/trunk@30004 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 02:50:24 +00:00
Boone Gorges ce810ba5b3 Add unit tests for WP_Comment_Query 'orderby' param.
For better testability, the SQL string generated in `WP_Comment_Query::get_posts()`
is now stored as a 'request' property on the object.

See #29902.

git-svn-id: https://develop.svn.wordpress.org/trunk@30003 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 02:33:46 +00:00
Boone Gorges 1fc0287164 Set current user to 0 after each unit test.
This prevents $current_user, $userdata, and other user-related globals from
being polluted if a previous test does not properly reset the current user.

Props nacin, mnelson4.
Fixes #29712.

git-svn-id: https://develop.svn.wordpress.org/trunk@30001 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-24 00:58:35 +00:00
Boone Gorges 9dafca7e2c Add unit tests for 'append' argument of wp_set_object_terms().
See #29624.

git-svn-id: https://develop.svn.wordpress.org/trunk@29997 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-23 13:52:57 +00:00
Andrew Ozz a454872630 TinyMCE: update to 4.1.6+. Adds support for cache-busting when auto-loading JS and CSS. Change the tests to run in /build. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #30079

git-svn-id: https://develop.svn.wordpress.org/trunk@29994 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-23 02:07:15 +00:00
Boone Gorges cc41c59286 Streamline WP_Date_Query unit tests.
By creating less dummy data and eliminating redundant tests, we cut group
execution time by more than 50%.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@29993 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-23 01:55:43 +00:00
Boone Gorges 48e77bd87f Generate fewer default posts in wp_list_authors() tests.
Saves about 7 seconds when running the suite.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@29992 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-23 01:14:24 +00:00
Boone Gorges 34f0e3844b Add unit test for `WP_Comment_Query` 'search' param.
git-svn-id: https://develop.svn.wordpress.org/trunk@29982 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-21 14:17:25 +00:00
Boone Gorges a14c675dea Remove redundant unit test for `WP_Comment_Query` 'status'.
This old test is too resource-intensive, and duplicates the more precise
tests introduced in [29980].

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@29981 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-21 14:17:17 +00:00
Boone Gorges 11e0a527f7 Improve unit tests for 'status' param in `WP_Comment_Query`.
See #29612.

git-svn-id: https://develop.svn.wordpress.org/trunk@29980 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-21 13:40:33 +00:00
Boone Gorges dc141fc510 Remove failing unit test for #27193.
This ticket was closed as invalid, so we no longer need this test.

git-svn-id: https://develop.svn.wordpress.org/trunk@29979 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-21 13:40:27 +00:00
Dion Hulse 5bcbdefd2e HTTP API: Support both the 'limit_response_size' and 'stream' parameters at the same time, allowing a partial file download.
Fixes #26726


git-svn-id: https://develop.svn.wordpress.org/trunk@29968 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-20 07:31:45 +00:00
Sergey Biryukov 79734b0677 Update expected results in wp_add_inline_style() unit tests after [29958].
props georgestephanis.
see #30032.

git-svn-id: https://develop.svn.wordpress.org/trunk@29967 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-19 21:23:32 +00:00
Boone Gorges 348c8958da Use the comment API rather than direct SQL queries in `comments_template()`.
`comments_template()` is used by most themes to display a post's comments. It
shows all comments that have been approved, and also shows all pending comments
by the current visitor (as determined by the comment cookies). However, the
comments API previously had no way of querying for "all comments that are
either approved, or are unapproved but written by foo@example.com". The
workaround was a direct SQL query: uncached, not subject to the same filters as
other comment queries, and just generally icky.

The new `include_unapproved` parameter for `WP_Comment_Query` accepts an array
of user IDs or email addresses. Pending comments associated with users in this
array will be included in query results, regardless of the value of the 'status'
parameter. In `comments_template()`, we leap from direct SQL queries to
`get_comments()` plus `include_unapproved', striving to put right what once
went wrong.

Props boonebgorges, simonwheatley, hardy101, jesin.
Fixes #19623.

git-svn-id: https://develop.svn.wordpress.org/trunk@29965 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-19 19:38:16 +00:00
Boone Gorges 91733ae919 Make orderby=meta_value compatible with meta_query when relation=OR.
Passing orderby=meta_value and meta_key=foo to WP_Query should require that
each matched post have a meta value with the key 'foo'. To make this
requirement compatible with meta_query params that have the relation OR, we
nest the meta_query param, and join it using AND to a meta_query clause
generated from the meta_key/meta_compare/meta_type query vars.

Fixes #25538.

git-svn-id: https://develop.svn.wordpress.org/trunk@29964 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-19 18:53:55 +00:00
Boone Gorges fd7d38ec3b Ensure that post types and taxonomies are reset between multisite tests.
This is a port of [29869] to multisite.xml.

See #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29954 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-18 02:31:46 +00:00
Sergey Biryukov 49c33927b5 Fix formatting in [29946].
props TobiasBg.
fixes #29925.

git-svn-id: https://develop.svn.wordpress.org/trunk@29952 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 22:14:49 +00:00
Aaron Jorbin 230313d25a Check if WP_DEFAULT_THEME starts with twenty before asserting it is in default theme array
This fixes an issue that if you change WP_DEFAULT_THEME and run core unit tests, the tests fail since your theme isn't one of the hard coded lists of default themes. We need to keep this test to make sure that we update the array of default themes for use in other tests.

If we ever change the naming convention for default themes, this will need to be updated.

props nacin for initial idea
fixes #29925



git-svn-id: https://develop.svn.wordpress.org/trunk@29946 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 20:59:23 +00:00
Boone Gorges c2bea27bfd Invalidate cache for child terms when parent term is deleted.
Props socki03.
Fixes #29911.

git-svn-id: https://develop.svn.wordpress.org/trunk@29945 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 20:58:48 +00:00
Boone Gorges 1708a580fd Overhaul SQL generating logic in WP_Meta_Query to avoid unnecessary table joins.
The logic used to generate clause SQL in `WP_Meta_Query` is somewhat arcane,
stemming mostly from an ongoing effort to eliminate costly table joins when
they are not necessary. By systematizing the process of looking for shareable
joins - as was done in `WP_Tax_Query` [29902] - it becomes possible to simplify
the construction of SQL queries in `get_sql_for_clause()`. Moreover, the
simplified logic is actually considerably better at identifying shareable
joins, such that certain uses of `WP_Meta_Query` will see joins reduced by 50%
or more.

Includes integration tests for a representative cross-section of the query
clause combinations that result in shared table aliases.

Props boonebgorges, sc0ttkclark.
See #24093.

git-svn-id: https://develop.svn.wordpress.org/trunk@29940 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 20:20:04 +00:00
Scott Taylor be59c5009e `wp_schedule_single_event()` should not prevent scheduling a future duplicate event. It should only reject an event as a duplicate if there is already a similar event scheduled within 10 minutes of the given timestamp.
Adds unit tests, fixes existing cron test.

Props tellyworth.

See [9181], #6966.
Fixes #28213.


git-svn-id: https://develop.svn.wordpress.org/trunk@29939 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 19:16:26 +00:00
Jeremy Felt 611a4aa969 Improve and reduce tests for get_blogs_of_user()
* Create half as many factory sites. See #30017
* Test the removal of a user from multiple sites.
* Expand tests to include second parameter for flagged sites.
* Remove duplicate test for deleted user.

Fixes #29996


git-svn-id: https://develop.svn.wordpress.org/trunk@29937 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 03:01:21 +00:00
Boone Gorges 00f7ae376a Better "inclusive" support for string values in WP_Date_Query.
The 'inclusive' parameter for WP_Date_Query determines whether non-precise
dates for 'before' and 'after' will be rounded up or down. Previously, this was
supported only when 'before' and 'after' were arrays; string-formatted dates
were run through strtotime(), which rounded them all down (inclusive in the
case of after, non-inclusive in the case of before). Now, we attempt to parse
formats that look like MySQL-formatted date strings, and apply inclusive logic
to them if we recognize them successfully.

Fixes #29908.
string values. Array values support the 'inclusive

git-svn-id: https://develop.svn.wordpress.org/trunk@29936 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 02:27:44 +00:00
Boone Gorges aee4647da0 Comment/post author in/not_in for `WP_Comment_Query`.
Props nofearinc, chriscct7.
Fixes #29885.

git-svn-id: https://develop.svn.wordpress.org/trunk@29935 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 01:57:18 +00:00
Boone Gorges 64bc8466db Support date_query by user_registered in WP_User_Query.
Props ChriCo, nacin.
Fixes #27283.

git-svn-id: https://develop.svn.wordpress.org/trunk@29934 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 01:36:36 +00:00
Boone Gorges 42646e67b3 Use table aliases for columns in SQL generated by WP_Date_Query.
The use of non-aliased column names (eg 'post_date' instead of 'wp_posts.post_date')
in WP_Date_Query causes SQL notices and other failures when queries involve
table joins, such as date_query combined with tax_query or meta_query. This
changeset modifies WP_Date_Query::validate_column() to add the table alias when
it can be detected from the column name (ie, in the case of core columns).

A side effect of this change is that it is now possible to use WP_Date_Query
to build WHERE clauses across multiple tables, though there is currently no
core support for the automatic generation of the necessary JOIN clauses. See

Props ew_holmes, wonderboymusic, neoxx, Viper007Bond, boonebgorges.
Fixes #25775.

git-svn-id: https://develop.svn.wordpress.org/trunk@29933 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 01:19:03 +00:00
Boone Gorges 8692199bb5 Add expectedIncorrectUsage flags for unit tests that generate invalid dates.
Since [29925], passing an invalid date to WP_Date_Query will generate a
_doing_it_wrong() notice. The current changeset adds the
`@expectedIncorrectUsage` flag to those existing unit tests that generate
invalid dates, such as those that test canonical redirect and is_404()
conditionals.

Fixes #25834.

git-svn-id: https://develop.svn.wordpress.org/trunk@29932 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-17 00:40:06 +00:00
Boone Gorges 44bb383371 Remove invalid `continue` calls from WP_Tax_Query::get_sql_for_clause().
This was leftover code from the previous implementation, which used a `foreach()`
loop. See [29901].

Props nofearinc.
See #29738, #29718.

git-svn-id: https://develop.svn.wordpress.org/trunk@29931 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 22:06:46 +00:00
Boone Gorges a3da10deb0 Throw notices when invalid date values are passed to WP_Date_Query.
`_doing_it_wrong()` notices are now generated when passing out-of-range values
(`month=13`) or invalid dates (`2014-02-29`).

Includes unit tests.

Props ChriCo.
Fixes #25834.

git-svn-id: https://develop.svn.wordpress.org/trunk@29925 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 20:11:13 +00:00
Boone Gorges a3e0c08f2f Introduce nested query support to WP_Date_Query.
This enhancement makes it possible to filter post, comment, and other queries
by date in ways that are arbitrarily complex, using mixed AND and OR relations.

Includes unit tests for the new syntax. In a few places, the existing unit
tests were slightly too strict (such as when checking the exact syntax of a SQL
string); these existing tests have been narrowed.

Props boonebgorges.
Fixes #29822.

git-svn-id: https://develop.svn.wordpress.org/trunk@29923 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 19:33:24 +00:00
Jeremy Felt f0b35fe7d5 Split and organize multisite unit tests
* Move `ms.php` to `multisite.php`
* Create `multisite.php` under directories `option/` and `user/` to better match existing structure.
* Create a `multisite/` directory containing `bootstrap.php`, `site.php`, and `network.php` for very multisite specific testing.
* Add unit test groups ms-site, ms-user, ms-option, ms-network, and ms-bootstrap.

Fixes #29896


git-svn-id: https://develop.svn.wordpress.org/trunk@29916 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 05:06:22 +00:00
Scott Taylor 0d58d32462 Cache `get_term_by()` calls:
* Add a helper function, `wp_get_last_changed()`, to retrieve a last-modified timestamp by cache group
* When caching a term, also make cache entries for slug and name via `slug:{$term_id}` and `name:{$term_id}` keys in the `$taxonomy:$last_changed` bucket that reference the term_id
* In `clean_term_cache()` and `update_term_cache()`, respect `$_wp_suspend_cache_invalidation`
* Original term cache entries maintain BC

Adds unit tests.

Props wonderboymusic, tollmanz, boonebgorges.
Fixes #21760.


git-svn-id: https://develop.svn.wordpress.org/trunk@29915 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 04:44:13 +00:00
Scott Taylor 248fc182b8 Fix `Tests_Paginate_Links` tests by properly setting up / tearing down permalink structure.
Props jorbin.
Fixes #29636.


git-svn-id: https://develop.svn.wordpress.org/trunk@29913 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 04:22:16 +00:00
Boone Gorges e36cac6794 Check that search value is scalar before parsing.
Prevents PHP notices when non-scalar values are passed.

Includes unit tests.

Props tivnet.
Fixes #29736.

git-svn-id: https://develop.svn.wordpress.org/trunk@29912 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-16 03:31:27 +00:00
Boone Gorges d4239b67da Fix test_build_mysql_datetime_datetime_non_array().
The expected value was being incorrectly built.

git-svn-id: https://develop.svn.wordpress.org/trunk@29906 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-15 17:52:05 +00:00
Boone Gorges 56c82e534f Avoid redundant table joins in WP_Tax_Query.
IN clauses that are connected by OR require only a single table join. To avoid
extraneous joins, keep track of generated table aliases, and let sibling
clauses piggy-back on those aliases when possible.

Introduces WP_Tax_Query::sanitize_relation() to reduce some repeated code.

Adds unit tests to verify the JOIN consolidation, and integration tests for
cases where JOINS are being combined.

Props boonebgorges, otto42, jakub.tyrcha.
Fixes #18105.

git-svn-id: https://develop.svn.wordpress.org/trunk@29902 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-15 16:39:19 +00:00
Boone Gorges 2796b6969f Support 'EXISTS' and 'NOT EXISTS' in `WP_Tax_Query`.
These new values for the 'operator' parameter make it possible to filter items
that have no term from a given taxonomy, or any term from a given taxonomy.

Includes unit tests.

Fixes #29181.

git-svn-id: https://develop.svn.wordpress.org/trunk@29896 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-15 00:53:22 +00:00
Andrew Nacin 209a4c6a86 Set Twenty Fifteen as the new default theme. see #29799.
git-svn-id: https://develop.svn.wordpress.org/trunk@29895 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-14 19:57:13 +00:00
Andrew Nacin 3640f40a12 Fix theme support unit test added in [27220].
The test assumed that the active theme either had no menu locations, or a subset of 'primary' and 'secondary'. see #26900.


git-svn-id: https://develop.svn.wordpress.org/trunk@29894 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-14 19:54:03 +00:00
Boone Gorges 6d94c2e30d Introduce support for nested queries in WP_Tax_Query.
Previously, tax query arguments could be joined by a single AND or OR relation.
Now, these queries can be arbitrarily nested, allowing clauses to be linked
together with multiple relations.

In a few places, WP_Query runs through a list of clauses in a tax_query in order
to set certain query vars for backward compatibility. The necessary changes have
been made to WP_Query to support this feature with the new complex structure of
tax_query. Unit tests are included for these backward compatibility fixes.

Unit tests for the new nesting syntax are included.

Props boonebgorges.
Fixes #29718. See #29738.

git-svn-id: https://develop.svn.wordpress.org/trunk@29891 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-14 04:02:41 +00:00
Boone Gorges 40dc982a30 Use only LEFT JOINs when a meta_query contains a NOT EXISTS clause.
Mixing LEFT and INNER JOIN in these cases results in posts with no metadata
being improperly excluded from results.

Props johnrom.
Fixes #29062.

git-svn-id: https://develop.svn.wordpress.org/trunk@29890 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-14 02:16:28 +00:00
Boone Gorges 1fcb79f008 Use assertEqualSets() for a few taxonomy-related tests.
assertEquals() was causing problems in environments where the tests take more
than one second to run, thereby causing results to be returned in the incorrect
order.

git-svn-id: https://develop.svn.wordpress.org/trunk@29888 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-14 00:18:28 +00:00
Boone Gorges 0b05366c6f Introduce support for nested queries in WP_Meta_Query.
Previously, meta query arguments could be joined by a single AND or OR relation.
Now, these queries can be arbitrarily nested, allowing clauses to be linked
together with multiple relations.

Adds unit tests for the new nesting syntax. Modifies a few existing unit tests
that were overly specific for the old SQL syntax. Backward compatibility with
existing syntax is fully maintained.

Props boonebgorges, DrewAPicture.
See #29642.

git-svn-id: https://develop.svn.wordpress.org/trunk@29887 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-13 22:02:18 +00:00
Boone Gorges c10a0ae277 Don't create dummy data for each date query test.
The integration tests for using date_query in WP_Query require the creation of
dummy post data, much of which is common between a number of tests. However,
newer tests do not require as much data, so to reduce overhead we create the
data explicitly only when we need it, instead of in the setUp() method.

See #29781.

git-svn-id: https://develop.svn.wordpress.org/trunk@29885 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-13 00:17:12 +00:00
Jeremy Felt 7fc02a2abd Reset multisite unit tests global stack to original host after testing bootstrap
After using `_setup_host_request()` to test multiple domain and path combinations, use the same to set the global stack back to a domain of `WP_TESTS_DOMAIN` and path of `/`.

Fixes #29930


git-svn-id: https://develop.svn.wordpress.org/trunk@29881 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-12 01:41:43 +00:00
Boone Gorges 9c28ce9974 Improve unit test coverage for wp_update_term().
See #5809, #22023.

git-svn-id: https://develop.svn.wordpress.org/trunk@29875 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-11 04:36:44 +00:00