Commit Graph

661 Commits

Author SHA1 Message Date
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
Sergey Biryukov 34a58febd8 Ensure themes don't have to call add_image_size() to be used in unit tests.
props mboynes.
fixes #29924.

git-svn-id: https://develop.svn.wordpress.org/trunk@29874 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-11 04:22:11 +00:00
Boone Gorges f7dbf962d7 Only reset taxonomies and post types between tests when running core tests.
A growing number of plugins and other WP-based projects use the core test
tools, such as WP_UnitTestCase, as the basis of their own tests and continuous
integration setups. At the same time, many of these third-party plugins use
custom post types and taxonomies, which are generally registered a single time
during a run of the tests: at 'init', before the testcases have run. Wiping out
these globals between tests will mess with these third-party builds.

Best practice for plugin developers is probably to clean up their own post types
and taxonomies and then reinitialize before each test. But, in the interest of
not breaking everyone's builds, the core test suite will not enforce this.

Fixes #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29869 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-10 20:25:39 +00:00
Boone Gorges bce6d64d59 Return an error when adding a term to a non-existent parent.
Parallels the logic of wp_insert_term(), introduced in [29196].

Props jesin.
Fixes #29614.

git-svn-id: https://develop.svn.wordpress.org/trunk@29867 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 18:11:17 +00:00
Boone Gorges adbed947d8 Don't bail out of term_exists() when term sanitizes to an empty string.
This change brings return values for failures of this sort in line with other
failed lookups in term_exists(): a null value is now returned in all cases
where the queried term is not found.

Adds unit test for the sanitization issue. Modifies existing unit test to
reflect the change in return value for empty term strings.

Props boonebgorges, georgestephanis.
Fixes #29589.

git-svn-id: https://develop.svn.wordpress.org/trunk@29865 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 03:15:50 +00:00
Dion Hulse 8ff133f232 Add some unit tests for WP_HTTP::parse_url() to cover the <PHP 5.4.7 compatibility alterations.
These unit tests cover the expected vehaviour of certain combinations of URL's, but makes no attempt to test invalid URL structures, as PHP's behavious for invalid URL's is undefined (Some will be treated as paths, others fail, and it varies between PHP 5.4.7+ and <5.4.7).
This change also makes WP_HTTP::parse_url() protected in order to allow unit testing.
See #28001, #29886


git-svn-id: https://develop.svn.wordpress.org/trunk@29864 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 03:00:16 +00:00
Boone Gorges 568b43f242 Fix term_exists() for parent = 0.
Passing a 0 (or '0') as the 'parent' param of term_exists() should limit
results to terms with no parent.

Adds unit test.

Fixes #29851.

git-svn-id: https://develop.svn.wordpress.org/trunk@29863 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 02:48:47 +00:00
Boone Gorges 01c529e062 Improve 'alias_of' handling in wp_insert_term() and wp_update_term().
Using get_term_by() rather than direct SQL queries to fetch the alias term
fixes a number of issues:

* Object cache for aliased term is properly cleared after update.
* If the aliased term is in the object cache, it's served from there, saving a database query.
* Duplicate 'edit_terms' and 'edited_terms' hooks can be removed.
* Fix a PHP notice when the 'alias_of' term is not found.
* Prevent the incorrect creation of a new term group for the primary term when the 'alias_of' term is not found.

Adds unit tests for 'alias_of' functionality in both functions.

Fixes #29848.

git-svn-id: https://develop.svn.wordpress.org/trunk@29862 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 02:31:35 +00:00
Boone Gorges 5e7be10860 Reset post types and taxonomies before each unit test.
Registering a post type or taxonomy during a unit test causes modifications to
global variables. If the test fails to clean up these globals - either by
neglecting to call _unregister_post_type()/_unregister_taxonomy() at all or by
failing before getting a chance to do so - tests that run later in the suite
can fail, leading to much gnashing of teeth. Wiping all taxonomies and
restoring to the defaults before each test ensures that we always start with a
clean slate.

Fixes #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29860 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 00:57:26 +00:00
Aaron Jorbin 3bfa930580 Change assertEqual to assertEqualSets since the order that travis-ci creates posts isn't consistent
see #29718



git-svn-id: https://develop.svn.wordpress.org/trunk@29857 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 19:21:30 +00:00
Konstantin Kovshenin 061fe13c9f Use the primary `meta_query` clause when parsing `orderby` in `WP_Query`.
When using legacy `meta_key`, `meta_value`, etc. arguments in `WP_Query`,
they're converted into the first clause of a `meta_query`. By using that
clause instead of the original arguments, we make sure that behavior is
consistent between the two available formats.

props boonebgorges.
fixes #16814.


git-svn-id: https://develop.svn.wordpress.org/trunk@29855 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 15:11:14 +00:00
Konstantin Kovshenin 6eea081457 New `remove()` method and some unit tests for the `WP_Error` class.
props stephenharris.
fixes #28092.


git-svn-id: https://develop.svn.wordpress.org/trunk@29854 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 07:11:09 +00:00
Dion Hulse 4ae1397f96 Correctly support Schemeless URLs in WP_HTTP::make_absolute_url() by respecting the 'host' field if present in the relative url.
Fixes #29886


git-svn-id: https://develop.svn.wordpress.org/trunk@29851 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 05:57:15 +00:00
Dion Hulse e4268adfde Correctly handle url's containing url's in WP_HTTP::make_absolute_url().
A valid relative URL could be mistaken for an absolute url if it contained a :// in any position of the url.
Fixes #28001


git-svn-id: https://develop.svn.wordpress.org/trunk@29850 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 05:37:56 +00:00
Boone Gorges e79c2e0c9e In get_terms(), select term taxonomy count for all values of 'fields'.
Not having the count caused queries with 'fields' values of 'id=>name' and
'id=>slug' to return incorrect results when querying a hierarchical taxonomy
with 'hide_empty=true'.

Includes unit tests for get_terms() when using various combinations of 'fields',
'hide_empty', and 'hierarchical' arguments.

Props technical_mastermind.
Fixes #29859.

git-svn-id: https://develop.svn.wordpress.org/trunk@29845 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-06 22:04:11 +00:00
Sergey Biryukov 1a7c4efa13 Fix setting default quality in WP_Image_Editor.
props markoheijnen.
fixes #29856 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29834 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-04 13:11:38 +00:00
Boone Gorges ecac4d4a94 Improve unit test coverage for wp_insert_term().
See #5809, #22023.

git-svn-id: https://develop.svn.wordpress.org/trunk@29830 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-03 13:30:22 +00:00
Sergey Biryukov 569a80e488 Add unit tests for get_blog_details().
props jeremyfelt.
fixes #29845.

git-svn-id: https://develop.svn.wordpress.org/trunk@29824 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 21:47:25 +00:00
Boone Gorges 6ffb0fcafb Always sanitize user_nicename in wp_insert_user().
Previously, a 'user_nicename' parameter passed into the function was
unsanitized. This could result in a mismatch between the sanitized nicename
generated automatically at user creation, resulting in broken author archive
permalinks.

Props joemcgill.

Fixes #29696.

git-svn-id: https://develop.svn.wordpress.org/trunk@29819 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 18:53:24 +00:00
Scott Taylor dcef5d4583 In `activate_plugin()`, do not re-run the activation routine for already-active network-wide plugins.
Adds unit test.

Props jbrinley.
Fixes #28651.


git-svn-id: https://develop.svn.wordpress.org/trunk@29818 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 15:55:51 +00:00
Boone Gorges dd9e9501c1 WP_Comment_Query: comment__in, comment__not_in, post__in, post__not_in.
Props nofearinc, mordauk, boonebgorges

Fixes #25386

git-svn-id: https://develop.svn.wordpress.org/trunk@29808 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 01:40:56 +00:00
Boone Gorges 6dc662431a Improve unit tests for WP_Tax_Query.
* Exhaustive tests for publicly available functionality of WP_Tax_Query.
* For tests that are related to the tax_query argument as used in WP_Query, move to tests/post/query.php.
* Add some tax_query tests to cover single vs multiple queries using AND and OR; various values for 'field'; various values for 'operator'.
* Improve test names.
* Correct @group annotations.
* Improve performance of some WP_Query-related tests by declaring 'update_post_meta/term_cache' false.

Fixes #29718

git-svn-id: https://develop.svn.wordpress.org/trunk@29805 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 01:07:20 +00:00
Boone Gorges 1f6fd2c926 Improve unit tests related to WP_Meta_Query.
* More complete test coverage for publicly available methods of WP_Meta_Query.
* Move tests that rely on WP_Query (via the meta_query parameter) to tests/post/query.php.
* Better coverage for basic use cases of 'meta_query', including all values of 'compare' and default values of 'key', 'value', and 'compare'.
* Improve performance for tests that run WP_Query, by retrieving only post IDs and not prefetching postmeta and post terms.
* Add 'public' visibility keywords to test methods.
* Whitespace cleanup.

Fixes #29560

git-svn-id: https://develop.svn.wordpress.org/trunk@29799 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 21:17:38 +00:00
Boone Gorges 0b80b40d59 Improve unit test coverage for duplicate term creation.
These include an exhaustive set of tests for term_exists(), as well as tests
for wp_insert_term() that demonstrate failure when attempting to create a
duplicate term.

Props simonwheatley for an initial patch.

See #22023.


git-svn-id: https://develop.svn.wordpress.org/trunk@29798 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 14:59:10 +00:00
Boone Gorges 780c6962e5 Improve parameter sanitization in WP_Date_Query::build_query().
* Don't run non-numeric values through intval() for sanitization; this transforms them into 1s and 0s, which can cause unintended results.
* Be more generous about numeric array keys (don't require 0 and 1) in BETWEEN and NOT BETWEEN clauses.

Fixes #29801.

git-svn-id: https://develop.svn.wordpress.org/trunk@29797 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 14:03:49 +00:00
Boone Gorges 5a288bad58 Fix file location for WP_Date_Query tests introduced in r29793.
See #29781


git-svn-id: https://develop.svn.wordpress.org/trunk@29794 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 16:19:53 +00:00
Boone Gorges fd816091a5 Improved unit test coverage for WP_Date_Query
- Unit tests for all publicly available functionality in WP_Date_Query
- Improve performance of date_query tests that use WP_Query

Fixes #29781


git-svn-id: https://develop.svn.wordpress.org/trunk@29793 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 16:04:46 +00:00
Sergey Biryukov f6753a316a Change the default orderby value in wp_get_nav_menus() to 'name'.
props voldemortensen, igmoweb.
fixes #29460.

git-svn-id: https://develop.svn.wordpress.org/trunk@29792 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 15:44:26 +00:00
Mark Jaquith be8a0c6f89 Use HTTPS URLs for trac.wordpress.org (and use core.trac.wordpress.org)
see #27115

git-svn-id: https://develop.svn.wordpress.org/trunk@29789 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 13:36:38 +00:00
Mark Jaquith 7063377539 Use HTTPS URLs for core.trac.wordpress.org
see #27115

git-svn-id: https://develop.svn.wordpress.org/trunk@29788 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 13:27:55 +00:00
Scott Taylor 23f7f53be2 The joys of `wptexturize()`:
* Revert parts of [28773] and [28727] and [29748].
* Do not crash PHP. Make the shortcode quantifier possessive to avoid backtracks.
* Reduce backtracking in long HTML comments by 100x.
* Do not ignore unclosed HTML comments.
* Do not break unregistered shortcodes, e.g. `[hello attr="value"]`.
* Do not break HTML in shortcode attributes, e.g. `[hello attr="<"]`.
* Do not match for shortcodes when there is extra whitespace, e.g. `[ hello ]`.
* Add unit tests to show #12690 was not fully resolved.
* Tested PHP 5.2.4, 5.2.13, 5.4.32, and 5.5.8.

Adds/modifies unit tests.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29781 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 04:06:54 +00:00
Scott Taylor 18adbb6439 In `paginate_links()`, ensure that query string args are propagated to the resulting paginated links.
Adds unit tests that use `DOMDocument` since `assertTag` is being deprecated - see #29545, [29746].

Props obenland, wonderboymusic.
Fixes #29636.


git-svn-id: https://develop.svn.wordpress.org/trunk@29780 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 04:02:23 +00:00
Sergey Biryukov 3226d8b867 Create correct permalinks for child posts of hierarchical post types when default permalinks are used.
props loushou.
fixes #29615 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29765 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-24 21:29:15 +00:00
Scott Taylor 0b0eb4fb20 Ordering by `RAND()`:
The shortcode callbacks for `gallery` and `playlist` check for `'RAND' == $atts['order']`, which isn't a valid value for `order`. Remove those checks and update the docs.

In `WP_Query`, if the value of `orderby` is `rand`, `order` is irrelevant and should be unset.

Adds unit tests.

Fixes #29629.


git-svn-id: https://develop.svn.wordpress.org/trunk@29760 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-23 03:51:24 +00:00
Scott Taylor f00f28cce0 `wp_extract_urls()` needs to also grab URLs with query strings and hashes.
Updates unit test.

Props hauvong, dlh.
Fixes #29314.


git-svn-id: https://develop.svn.wordpress.org/trunk@29756 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-23 02:49:22 +00:00
Scott Taylor 606cd967f6 `wptexturize()` improvements:
* Expand the `wptexturize()` RegEx to include the list of registered shortcodes.
* Avoid backtracking after `[` chars by not filtering params in registered shortcodes. This will cause escaped shortcodes and their params to become texturized if not registered.
* Registered shortcode params will never be texturized, even when escaped.
* Move all tests involving unregistered shortcodes to a new and improved unit.
* Update one test involving HTML within shortcode params.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29748 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-17 15:13:24 +00:00
Scott Taylor fbf974a962 After [29200] and [29250], `Tests_MS::test_multisite_bootstrap()` should no longer have the `@expectedDeprecated` annotation.
git-svn-id: https://develop.svn.wordpress.org/trunk@29747 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 18:05:06 +00:00
Scott Taylor fd0b0d5f4f `assertTag()` has been deprecated in PHPUnit 4.2. Rewrite some of the tests in `Tests_Paginate_Links` to use `DOMDocument`.
Props effstieler.
Fixes #29545.


git-svn-id: https://develop.svn.wordpress.org/trunk@29746 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 17:41:47 +00:00
Sergey Biryukov 6e0ca0d8d9 Make sure the $parent argument of wp_insert_attachment() still works as expected after [28579].
prop jesin, dikiy_forester.
fixes #29646 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29745 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 14:23:31 +00:00
Sergey Biryukov 445b364f5b Properly suppress errors in test_empty_where_on_update(), which expects an empty WHERE clause.
see #26106.

git-svn-id: https://develop.svn.wordpress.org/trunk@29701 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-04 04:30:11 +00:00
Andrew Nacin d8b80c3254 Unit tests for has_filter() not resetting the array pointer.
props pento.
fixes #29070. see [29472].


git-svn-id: https://develop.svn.wordpress.org/trunk@29665 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-02 06:49:11 +00:00
Andrew Nacin 1cde8312b6 DB: Revert [28814] and require a WHERE for wpdb::update().
see #26106.


git-svn-id: https://develop.svn.wordpress.org/trunk@29664 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-02 04:55:17 +00:00
Andrew Nacin 7c145e0bd9 Meta Query: Revert [28659] (and [28665]) due to regressions.
props boonebgorges.
fixes #29285. see #25538.


git-svn-id: https://develop.svn.wordpress.org/trunk@29650 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-27 20:22:35 +00:00
Andrew Nacin e3345398aa Rename the public methods in the session tokens API.
Introduces a new get( $token ) method. get_token() would not have made sense and spurred the overall renaming. Public methods are now get, get_all, verify, create, update, destroy, destroy_others, and destroy_all.

The protected abstract methods designed for alternative implementations remain the same.

props mdawaffe.
see #20276.


git-svn-id: https://develop.svn.wordpress.org/trunk@29635 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-27 02:06:53 +00:00
Andrew Nacin bf0272c8b1 Require a non-empty $nonce value in wp_verify_nonce().
props ocean90.
fixes #29217.


git-svn-id: https://develop.svn.wordpress.org/trunk@29620 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-26 07:38:51 +00:00
Andrew Ozz c83a9ca2c9 TinyMCE: update to 4.1.4-20140822. Changes:
- Fixed bug where sometimes the resize rectangles wouldn't properly render on images on WebKit/Blink. 9a2d01cc14
- Fixed nodeChanged selection issue where the image selection wouldn't be removed if you clicked right after/before it. dd729c67e0
- Fixed bug in list plugin where delete/backspace would merge empty LI elements in lists incorrectly. caadfb05dd
See #29310

git-svn-id: https://develop.svn.wordpress.org/trunk@29576 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-22 17:43:39 +00:00
Andrew Ozz 208645191d TinyMCE: update to 4.1.4. Changelog: http://www.tinymce.com/develop/changelog/?type=tinymce. Fixes #29310
git-svn-id: https://develop.svn.wordpress.org/trunk@29570 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-21 23:52:28 +00:00
Scott Taylor 89ed2c4217 Ensure that `$wpdb` is imported in `Tests_MS::_setup_host_request`.
Props tellyworth.
Fixes #27884.


git-svn-id: https://develop.svn.wordpress.org/trunk@29552 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-20 17:13:04 +00:00
Dominik Schilling (ocean90) 1ba2f5c853 Fix expected value in `Tests_Media::test_video_shortcode_body()`.
Since [29457] the `.wp-video` wrapper for a video has a height set.

fixes #29110.

git-svn-id: https://develop.svn.wordpress.org/trunk@29515 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-17 11:48:03 +00:00
Sergey Biryukov 262929004d Avoid undefined index notices in WP_UnitTestCase::_restore_hooks().
props kevinlangleyjr.
fixes #29123.

git-svn-id: https://develop.svn.wordpress.org/trunk@29503 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-15 15:40:48 +00:00
Andrew Ozz f8fed596ec TinyMCE: update to 4.1.3, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt, fixes #29166
git-svn-id: https://develop.svn.wordpress.org/trunk@29458 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-09 20:55:34 +00:00
Scott Taylor 06eea1b33d After [28883], ensure that priorities have callbacks before returning `true` in `has_filter()`.
Adds unit tests.

Props boonebgorges.
Fixes #29070.


git-svn-id: https://develop.svn.wordpress.org/trunk@29422 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-07 02:29:15 +00:00
Scott Taylor e9ba499f23 After [29339] and [29341], add more unit tests and less ambiguous type-checking before bailing in meta-related functions that expect a numeric value for `$object_id`.
Props SergeyBiryukov.
Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29421 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-06 22:07:42 +00:00
Sergey Biryukov 1cc1956a1f Consolidate some of the test functions added in [29344].
see #28310.

git-svn-id: https://develop.svn.wordpress.org/trunk@29351 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 21:06:49 +00:00
Scott Taylor 7374913866 Add unit tests for `Walker` class.
Props willmot.
See #15667.


git-svn-id: https://develop.svn.wordpress.org/trunk@29347 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 20:35:25 +00:00
Scott Taylor 91517ce620 Clarify that `get_the_date()`, `get_the_time()`, `get_post_time()` and `get_post_modified_time()` should return `false` when `get_post()` is `null`.
Adds unit tests.

Props GaryJ, SergeyBiryukov, tollmanz.
Fixes #28310.


git-svn-id: https://develop.svn.wordpress.org/trunk@29344 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:39:22 +00:00
Scott Taylor 0ee7c9c678 Update unit tests for `sanitize_file_name()` after [29290].
git-svn-id: https://develop.svn.wordpress.org/trunk@29342 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:29:46 +00:00
Scott Taylor 7677eb2f8e Account for `WP_IMPORTING` being defined in the unit tests added in [29339] when all tests are run.
Glory, glory hallelujah.

Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29341 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:27:16 +00:00
Scott Taylor 5686f4511a Bail on `update_user_meta()` when `$object_id` is non-numeric.
Adds unit test.

Props jacklenox, wonderboymusic.
Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29339 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 17:09:53 +00:00
Andrew Ozz 23d876d86a Tests Autop: remove <option> from the list of inline tags. It is valid only in specific context (<select>, <optgroup> or <datalist>) and should not be wrapped in <p>. Props kovshenin, fixes #28217.
git-svn-id: https://develop.svn.wordpress.org/trunk@29328 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-29 19:02:36 +00:00
Dominik Schilling (ocean90) 0f93a72879 Remove unit test for `is_https_url()`, see [29309].
see #28487.

git-svn-id: https://develop.svn.wordpress.org/trunk@29310 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-27 17:18:19 +00:00
Scott Taylor 1cbe1cec12 In `sanitize_file_name()`, replace `%20` and `+` with dashes. Remove unnecessary code from `_wp_handle_upload()`.
Adds unit tests.

Props ericmann.
Fixes #16330.


git-svn-id: https://develop.svn.wordpress.org/trunk@29290 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-24 22:08:09 +00:00
Helen Hou-Sandi c72d29e63e Revert [29267], as it causes unit test breakage and appears unnecessary. see #28986.
git-svn-id: https://develop.svn.wordpress.org/trunk@29274 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-23 02:22:57 +00:00
Scott Taylor 7f9edd3e69 After [29251], set the array keys in `WP_UnitTestCase::$hooks_saved` to prevent notices in 3rd party use cases.
Props danielbachhuber.
Fixes #28986.



git-svn-id: https://develop.svn.wordpress.org/trunk@29267 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-22 17:21:40 +00:00
Scott Taylor 77ee35c4eb `wp_script_is( ..., 'enqueued' )` needs to check dependencies recursively - a single item's dependencies may only be a subset of the full dependency tree. Adds a new method on `WP_Dependencies` called `->recurse_deps()`.
Adds unit test.

Props wonderboymusic, SergeyBiryukov, mikejolley.
Fixes #28404.


git-svn-id: https://develop.svn.wordpress.org/trunk@29252 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-20 00:28:57 +00:00
Scott Taylor 36e455d018 Backup filter globals ( `$merged_filters, $wp_actions, $wp_current_filter, $wp_filter` ) statically when running unit tests, restore on `tearDown()`. This ensures that all tests initially use the same filters/actions.
Props mnelson4, wonderboymusic.
Fixes #28535.


git-svn-id: https://develop.svn.wordpress.org/trunk@29251 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-19 23:58:07 +00:00