This plugin can automatically format text patterns as you type. It includes two patterns: unordered (`* ` and `- `) and ordered list (`1. ` and `1) `). If the transformation in unwanted, the user can undo the change by pressing backspace, using the undo shortcut, or the undo button in the toolbar.
This is the first TinyMCE plugin that has unit tests and there's some good groundwork for adding tests to existing plugins in the future.
First run. See #31441.
git-svn-id: https://develop.svn.wordpress.org/trunk@32699 602fd350-edb4-49c9-b593-d223f7449a82
This allows user query results to be limited to those users who have published
posts in at least one of the specified post types.
Props joehoyle, boonebgorges.
Fixes#32250.
git-svn-id: https://develop.svn.wordpress.org/trunk@32683 602fd350-edb4-49c9-b593-d223f7449a82
* Always fall back to using the default template if no custom template exists.
* Provide a set of default params when constructing new `Section` and `Panel` objects.
Includes QUnit tests.
Props celloexpressions, westonruter, ocean90.
Fixes#30737.
git-svn-id: https://develop.svn.wordpress.org/trunk@32681 602fd350-edb4-49c9-b593-d223f7449a82
The override is necessary because the `get_term()` call, which fetches the
term object, needs the `'taxonomy'` argument passed to the factory method.
Props dlh.
Fixes#32536.
git-svn-id: https://develop.svn.wordpress.org/trunk@32659 602fd350-edb4-49c9-b593-d223f7449a82
A URL like `example.com/2015/05/15/` generally resolves to the May 15, 2015 date
archive. But in certain cases, it could also be the permalink of a post with
the slug `'2015'`. When a conflict of this sort is detected, resolve to the post
instead of the archive.
URL conflicts of this sort should no longer occur for new posts; see [32647].
Props valendesigns, boonebgorges, Denis-de-Bernardy.
Fixes#5305.
git-svn-id: https://develop.svn.wordpress.org/trunk@32648 602fd350-edb4-49c9-b593-d223f7449a82
On certain permalink structures, a numeric post slug will result in a post
permalink that conflicts with a date archive URL. For example, with permastruct
`/%year%/%monthnum%/%postname%/`, a post published in May 2015 with slug
`'15'` will result in a URL (`/2015/05/15/`) that conflicts with the archive
for May 15, 2015.
To avoid this problem, `wp_unique_post_slug()` rejects a requested slug when it
would generate a conflict of this type. Thus, in our example, `'15'` would
become `'15-2'`.
Props valendesigns, boonebgorges, Denis-de-Bernardy, loushou.
See #5305.
git-svn-id: https://develop.svn.wordpress.org/trunk@32647 602fd350-edb4-49c9-b593-d223f7449a82
* Move to a separate file for better organization and method names.
* Use a `dataProvider` when appropriate, for better readability.
* Add a test for splitting the banned domain list on line breaks.
See #20459, #21730.
git-svn-id: https://develop.svn.wordpress.org/trunk@32638 602fd350-edb4-49c9-b593-d223f7449a82
Cleans up tests for sanitization of `illegal_names`, `illegal_email_domains`, and `banned_email_domains` network options.
Fixes#32517.
git-svn-id: https://develop.svn.wordpress.org/trunk@32634 602fd350-edb4-49c9-b593-d223f7449a82
Previously, `archived`, `spam`, and `deleted` properties were forced to `0` when returned by `get_blogs_of_user()`. This was originally introduced in [21794] as a way to prevent notices when properties were expected.
Instead, we can properly fill these properties with those retrieved from `get_blog_details()`.
Props realloc.
Fixes#32281.
git-svn-id: https://develop.svn.wordpress.org/trunk@32626 602fd350-edb4-49c9-b593-d223f7449a82
Plugins can use `pre_option_widget_{$id_base}` filters to return `ArrayIterator`/`ArrayObject` instances instead of primitive arrays. This makes possible for widget instance data to be drawn from somewhere else than `wp_options`, such as a custom post type.
Add unit tests for widgets.
Fixes#32474.
git-svn-id: https://develop.svn.wordpress.org/trunk@32602 602fd350-edb4-49c9-b593-d223f7449a82
This new argument allows developers to specify which term field should be
matched by the value of the `$term` parameter (in particular, 'name' and
'term_taxonomy_id' are now supported).
Props sudar, mordauk.
Fixes#14156.
git-svn-id: https://develop.svn.wordpress.org/trunk@32553 602fd350-edb4-49c9-b593-d223f7449a82
* Don't accept a comma-separated list, only a single post type or an array of post types. This is easier to document.
* Add changelog entries to all calling functions.
Props DrewAPicture.
Fixes#32243.
git-svn-id: https://develop.svn.wordpress.org/trunk@32524 602fd350-edb4-49c9-b593-d223f7449a82
A hard coded `example.org` would break the test if a custom `WP_TESTS_DOMAIN` was specified. We should defer to the configured default.
Fixes#32026.
git-svn-id: https://develop.svn.wordpress.org/trunk@32512 602fd350-edb4-49c9-b593-d223f7449a82
Custom pagination query vars, as provided in the 'base' parameter, must be
detected in the current page URL and removed before generating fresh pagination
links. The logic introduced in this changeset ensures that these custom
query vars are properly detected in cases where the 'format' param contains
a `#`.
This is a follow-up to [31203] #30831.
Fixes#31939.
git-svn-id: https://develop.svn.wordpress.org/trunk@32359 602fd350-edb4-49c9-b593-d223f7449a82
YouTube recently changed its oEmbed endpoint so that the iframe markup always
contains an HTTPS URL, regardless of the scheme of the video URL originally
requested. This changeset fixes the corresponding unit test.
Fixes#32260.
git-svn-id: https://develop.svn.wordpress.org/trunk@32358 602fd350-edb4-49c9-b593-d223f7449a82
Values of 'name' that contain db-encoded character on insert - like an
ampersand, which is HTML-encoded in the database - will only match if they go
through the same `sanitize_term_field()` routine.
Fixes#32248.
git-svn-id: https://develop.svn.wordpress.org/trunk@32353 602fd350-edb4-49c9-b593-d223f7449a82
Detecting SSL status on the Dashboard introduces problems when writing content
that is saved to the database and then displayed on the front end, where SSL
may be optional (or impossible, due to self-signed certificates). The new
approach parallels the logic in `get_home_url()` for forcing HTTPS.
See [31614] #15928 for background.
Fixes#32112 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@32342 602fd350-edb4-49c9-b593-d223f7449a82
In `delete_metadata()`, be stricter about when to ignore a falsey value of
`$meta_value`.
For backward compatibility, an empty string for `$meta_value` is equivalent to
`null` or `false`.
Props sc0ttkclark.
Fixes#32224.
git-svn-id: https://develop.svn.wordpress.org/trunk@32331 602fd350-edb4-49c9-b593-d223f7449a82
Descending the term tree causes unnecessary database queries when priming the
cache for a term with many descendants.
Fixes#31724.
git-svn-id: https://develop.svn.wordpress.org/trunk@32294 602fd350-edb4-49c9-b593-d223f7449a82
Passing `false` to `add_rewrite_endpoint()` will now allow you to take
advantage of the rewrite API without thereby modifying the way that WP sets up
the main query from the request URI.
This new functionality allows developers to work around certain edge-case bugs,
such as when a proper endpoint request (such as `/test/1/`) would short-
circuit `is_home()` calculation when a static front page is set.
Props mordauk, boonebgorges.
Fixes#25143.
git-svn-id: https://develop.svn.wordpress.org/trunk@32293 602fd350-edb4-49c9-b593-d223f7449a82
Instead, we point to the post type archive of the first registered
object_type that supports archives.
Props stevegrunwell, hrishiv90, boonebgorges.
Fixes#21881.
git-svn-id: https://develop.svn.wordpress.org/trunk@32292 602fd350-edb4-49c9-b593-d223f7449a82
Since [31669], the 'who' param had been parsed after meta_query was generated,
so that 'who' was effectively ignored.
Props imath.
Fixes#32019.
git-svn-id: https://develop.svn.wordpress.org/trunk@32207 602fd350-edb4-49c9-b593-d223f7449a82
The unit tests expect non-pretty permalinks, so there's no benefit to detecting
the ability to have pretty permalinks. Moreover, the `wp_remote_get()` call can
cause installation to hang when there are DNS issues.
Fixes#31994.
git-svn-id: https://develop.svn.wordpress.org/trunk@32139 602fd350-edb4-49c9-b593-d223f7449a82
When an incomplete header is provided (eg, 'From' with an email address but no
name), ensure that the WP defaults are filled in properly.
Props valendesigns.
Fixes#30266.
git-svn-id: https://develop.svn.wordpress.org/trunk@32070 602fd350-edb4-49c9-b593-d223f7449a82
`get_permalink()` will return a non-pretty permalink for future posts, which
breaks some user workflows that expect View Post to lead to a page with the
pretty permalink.
Fixes#30910.
git-svn-id: https://develop.svn.wordpress.org/trunk@32002 602fd350-edb4-49c9-b593-d223f7449a82
Fall back to term ID if the sanitized slug is numeric or only contains hyphens.
props SergeyBiryukov, A5hleyRich, sgrant, davideugenepratt.
fixes#30883.
git-svn-id: https://develop.svn.wordpress.org/trunk@31979 602fd350-edb4-49c9-b593-d223f7449a82
Although this logic looks a little strange at this low level, it's the best location within the Upgrades code for it to happen.
Fixes#31811
git-svn-id: https://develop.svn.wordpress.org/trunk@31936 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the tests were using '/feed/' in their `go_to()` statements, but
testing nodes for URLs like '?p='. This mismatch created unpredictable results
when the run in certain sequences with other groups of unit tests.
See #31705.
git-svn-id: https://develop.svn.wordpress.org/trunk@31846 602fd350-edb4-49c9-b593-d223f7449a82
* Introduce a `__construct()` method, which can accept an array of query vars.
* Move query logic out of `query()` method and into a new `get_comments()` method.
* Ensure that `$this->comments` is set whenever `get_comments()` returns a value.
* Introduce a `parse_query()` method, where query vars are parsed with default values and the 'parse_comment_query' action is fired.
These changes bring `WP_Comment_Query` syntax closer to that of `WP_Query`.
Props westonruter, morganestes, boonebgorges.
Fixes#24826.
git-svn-id: https://develop.svn.wordpress.org/trunk@31793 602fd350-edb4-49c9-b593-d223f7449a82
`wp_insert_term()` protects against the creation of terms with duplicate names
at the same level of a taxonomy hierarchy. However, it's historically been
possible to override this protection by explicitly providing a value of `$slug`
that is unique at the hierarchy tier. This ability was broken in [31734], and
the current changeset restores the original behavior.
A number of unit tests are added and refactored in support of these changes.
See #17689 for discussion of a fix that was superceded by [31734]. This commit
retains the fix for the underlying bug described in that ticket.
See #31328.
git-svn-id: https://develop.svn.wordpress.org/trunk@31792 602fd350-edb4-49c9-b593-d223f7449a82
The introduction of a Customizer test that creates a new blog [31707] causes
`WP_INSTALLING` to be set by the time the `wp_get_archives()` tests run. This,
in turn, causes the query counts to vary in unpredictable ways.
See #31130.
git-svn-id: https://develop.svn.wordpress.org/trunk@31764 602fd350-edb4-49c9-b593-d223f7449a82
Replace exisiting smilies with equivalent emoji, or with shiny new smiley images where no emoji existed.
Props batmoo, joen and mkaz for the original plugin upon which this is based.
Props pento, iseulde, kraftbj and peterwilsoncc for making the internet's dreams come true.
See #31242
git-svn-id: https://develop.svn.wordpress.org/trunk@31733 602fd350-edb4-49c9-b593-d223f7449a82
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.
props westonruter.
see #31484.
git-svn-id: https://develop.svn.wordpress.org/trunk@31705 602fd350-edb4-49c9-b593-d223f7449a82
The new 'submit_button' and 'submit_field' parameters for `comment_form()`
allow developers to modify the markup of the submit button and its wrapper.
These params are accompanied by targeted 'comment_form_submit_button' and
'comment_form_submit_field' filters on the concatenated markup.
Props coffee2code, morpheu5, DrewAPicture, boonebgorges.
Fixes#15015.
git-svn-id: https://develop.svn.wordpress.org/trunk@31699 602fd350-edb4-49c9-b593-d223f7449a82
Make sure the caption is always set if found. Previously, if the caption was less than 80 characters, only the Title field would be set.
props beaulebens, ericlewis, bendoh, SergeyBiryukov.
fixes#22768.
git-svn-id: https://develop.svn.wordpress.org/trunk@31694 602fd350-edb4-49c9-b593-d223f7449a82
Recent commits have added the ability to order query results by specific
clauses of the 'meta_query' parameter (comments [31467], posts [31312] and
[31340]). The current changeset ports the same functionality to `WP_User_Query`.
Also introduced is the ability to pass the value of `$meta_key` to 'orderby'.
The internals of `WP_User_Query::prepare_users()` had to be reordered
somewhat to support these changes, primarily to ensure that the `meta_query`
object generates its SQL clauses before the 'orderby' parameter is parsed.
See #31265.
git-svn-id: https://develop.svn.wordpress.org/trunk@31669 602fd350-edb4-49c9-b593-d223f7449a82
This changeset ports a number of 'orderby' features from `WP_Query` and
`WP_Comment_Query`:
* Allow multiple 'orderby' values to be passed as a space-separated list.
* Allow multiple 'orderby' values to be passed as a flat array.
* Allow multi-dimensional 'orderby', with orderby fields as array keys and ASC/DESC as the corresponding values.
See #31265.
git-svn-id: https://develop.svn.wordpress.org/trunk@31663 602fd350-edb4-49c9-b593-d223f7449a82
* In `WP_Query` and `WP_Comment_Query`, ensure that 'orderby' can parse multiple values for 'orderby' when passed as a space-separated string.
* In `WP_User_Query`, ensure that "shorthand" orderbys (like 'login' and 'name') are converted to their full versions (like 'user_login' and 'display_name').
See #31265.
git-svn-id: https://develop.svn.wordpress.org/trunk@31662 602fd350-edb4-49c9-b593-d223f7449a82
This change makes the 'post_type' clause in `wp_list_authors()` redundant, so
we remove it. Third-party plugins using `get_posts_by_author_sql()` may have
similarly redundant clauses, but this won't change the results returned by the
SQL queries.
Also adds unit tests for `get_posts_by_author_sql()`.
Props pbearne.
Fixes#30354.
git-svn-id: https://develop.svn.wordpress.org/trunk@31653 602fd350-edb4-49c9-b593-d223f7449a82
[31628] made it possible to pass an `$autoload` param to `update_option()` that
applies when the option does not yet exist in the database. The current
changeset introduces parity for existing options: the `$autoload` setting
for existing options can be changed via the `$autoload` parameter. For internal
simplicity, `$autoload` is ignored for existing options when `$value` is not
also changed.
This changeset also moves `update_option()` tests into their own class.
Props dd32.
Fixes#26394.
git-svn-id: https://develop.svn.wordpress.org/trunk@31640 602fd350-edb4-49c9-b593-d223f7449a82
When creating an option via `add_option()`, the `$autoload` param allows you to
tell WP whether the option should be loaded as part of the 'alloptions' cache
during every pageload. `update_option()`, when used with a non-existent option
calls `add_option()` internally. The new `$autoload` param in `update_option()`
is passed along to `add_option()` in cases where the option does not yet exist.
The associated unit tests are skipped on multisite due to an issue that causes
`WP_INSTALLING` to force cache misses. See #31130.
Props codix, nofearinc, MikeHansenMe.
Fixes#26394.
git-svn-id: https://develop.svn.wordpress.org/trunk@31628 602fd350-edb4-49c9-b593-d223f7449a82
`WP_UnitTestCase::tearDown()` restores the test environment to the default
conditions, including rolling back the MySQL transaction that the test takes
place in, resetting globals, and unhooking test-specific filters. As such, all
teardown routines for specific tests should happen before the parent class's
`tearDown()` method is called. Failure to do so can cause database locks on
certain configurations, among other problems.
See #31537.
git-svn-id: https://develop.svn.wordpress.org/trunk@31622 602fd350-edb4-49c9-b593-d223f7449a82
The 'cpage' query var is only set when using `comments_template()` to display
comments. If displaying them in a context where 'cpage' is not yet set, the
default value should be 1, not 0.
Props MomDad, couturefreak.
Fixes#20319.
git-svn-id: https://develop.svn.wordpress.org/trunk@31617 602fd350-edb4-49c9-b593-d223f7449a82
`wp_get_attachment_url()`, via `wp_upload_dir()`, uses 'siteurl' to generate
attachment URLs. When a site is SSL-optional on the front end - ie, 'siteurl'
is non-HTTPS, but SSL is available - a number of situations can arise where
non-HTTPS attachment URLs cause browser mixed-content warnings:
a) SSL is forced in the admin and `wp_get_attachment_url()` is used to generate the `<img>` tag for an inserted image. In these cases, the post content will contain non-HTTPS. Viewing/editing this post in the Dashboard will result in non-HTTPS images being served in an SSL environment.
b) `wp_get_attachment_url()` is used in a theme to generate an `<img>` `src` attribute on a public page. When viewing that page over SSL, the images will have HTTP URLs.
This changeset switches attachment URLs to HTTPS when it's determined that the
host supports SSL. This happens when 'siteurl' is non-SSL, but the current page
request *is* over SSL, and the host of the current request matches the host of
the URL being generated.
Props joemcgill, boonebgorges.
Fixes#15928.
git-svn-id: https://develop.svn.wordpress.org/trunk@31614 602fd350-edb4-49c9-b593-d223f7449a82
While RFC 3986 does not specify which character sets are allowed in URIs, Section 2.5 states that octects matching UTF-8 character encoding should be percent-encoded, then unreserved octets outside of the UTF-8 range should be percent-encoded. As browsers tend to only implement support for UTF-8 in URLs, this change only implements the UTF-8 encoding part. We may revisit the second part if it becomes an issue.
Fixes#31486
git-svn-id: https://develop.svn.wordpress.org/trunk@31587 602fd350-edb4-49c9-b593-d223f7449a82
This fixes an interface inconsistency in edit-tags.php, where Description
appears as a sortable column header.
Props neil_pie.
Fixes#31364.
git-svn-id: https://develop.svn.wordpress.org/trunk@31532 602fd350-edb4-49c9-b593-d223f7449a82
Failure to set this variable meant that passing the home URL to `go_to()`
(without a trailing slash) resulted in a PHP notice, and failed to reset the
globals properly.
Props joostdevalk.
Fixes#31417.
git-svn-id: https://develop.svn.wordpress.org/trunk@31515 602fd350-edb4-49c9-b593-d223f7449a82
PHP can be compiled without support for certain image types. Our unit tests
should be sensitive to these configurations.
Fixes#31124.
git-svn-id: https://develop.svn.wordpress.org/trunk@31510 602fd350-edb4-49c9-b593-d223f7449a82
`add_option()` and `update_option()` both call `get_option()` to compare the
value passed to the function with any existing value for the given option name.
When a `'default_option_'` filter is in place to change the default value of
an option, `add_option()` and `update_option()` ought to check against the
filtered value, rather than a hardcoded `false`, in order to determine whether
a prior value exists.
Props GregLone, tyxla.
Fixes#31047.
git-svn-id: https://develop.svn.wordpress.org/trunk@31473 602fd350-edb4-49c9-b593-d223f7449a82
* Do the `expectedDeprecated()` check in `assertPostConditions()` instead of `tearDown()`. Previously, `fail`ing inside of `tearDown()` was causing the rest of the teardown process to be aborted, resulting in inter-test leakage.
* Collect all `expectedDeprecated` and `expectedIncorrectUsage` annotations in an entire method and display them all when `fail`ing, instead of showing only the first one.
Props jdgrimes.
Fixes#31362.
git-svn-id: https://develop.svn.wordpress.org/trunk@31469 602fd350-edb4-49c9-b593-d223f7449a82
Since [29027], `WP_Query` has supported an array of values for the `$orderby`
parameter, with field names as array keys and ASC/DESC as the array values.
This changeset introduces the same syntax to `WP_Comment_Query`.
We leverage the new support for multiple ORDER BY clauses to fix a bug that
causes comments to be queried in an indeterminate order when sorting by the
default `comment_date_gmt` and comments share the same value for
`comment_date_gmt`. By always including a `comment_ID` subclause at the end of
the ORDER BY statement, we ensure that comments always have a unique fallback
for sorting.
This changeset also includes improvements paralleling those introduced to
`WP_Query` in [31312] and [31340], which allow `$orderby` to accept array keys
from specific `$meta_query` clauses. This change lets devs sort by multiple
clauses of an associated meta query. See #31045.
Fixes#30478. See #31265.
git-svn-id: https://develop.svn.wordpress.org/trunk@31467 602fd350-edb4-49c9-b593-d223f7449a82
`is_array( 1, '1-foo' )` returns true, which means that `is_page( 1 )`
was returning true when on a page with the slug '1-foo'. We avoid this odd
behavior by casting the queried object ID to a string before testing against
the value passed to the conditional function.
This also helps to avoid a problem where an arbitrary value for `$page` would
cause `is_page( $page )` to return true if the query had been manipulated by
a plugin to show that the current page's ID is 0.
Props boonebgorges, r-a-y, nunomorgadinho, wonderboymusic, clifgriffin.
Fixes#24674.
git-svn-id: https://develop.svn.wordpress.org/trunk@31458 602fd350-edb4-49c9-b593-d223f7449a82
[31370] has broken the test because the Customizer test enqueues some scripts. Unset `$GLOBALS['wp_scripts']` on tearDown() so other tests will start with zero enqueued scripts.
see #30936.
fixes#31302.
git-svn-id: https://develop.svn.wordpress.org/trunk@31426 602fd350-edb4-49c9-b593-d223f7449a82
When updating an existing taxonomy term that shares its `term_id` with
another term, we generate a new row in `wp_terms` and associate the updated
term_taxonomy_id with the new term. This separates the terms, such that
updating the name of one term does not change the name of any others.
In cases where a plugin or theme stores term IDs in the database, term splitting
can cause backward compatibility issues. The current changeset introduces
two utilities to aid developers with the transition. The `'split_shared_term'`
action fires when the split takes place, and should be used to catch changes in
term_id. In cases where `'split_shared_term'` cannot be used, the
`wp_get_split_term()` function gives developers access to data about terms
that have previously been split. Documentation for these functions, with
examples, can be found in the Plugin Developer Handbook. WordPress itself
stores term IDs in this way in two places; `_wp_check_split_default_terms()`
and `_wp_check_split_terms_in_menus()` are hooked to `'split_shared_term'` to
perform the necessary cleanup.
See [30241] for a previous attempt at the split. It was reverted in [30585]
for 4.1.0.
Props boonebgorges, mboynes.
See #5809.
git-svn-id: https://develop.svn.wordpress.org/trunk@31418 602fd350-edb4-49c9-b593-d223f7449a82
This fixes a bug introduced in [31359] where saving a tax_input that contained
only whitespace would result in a random tag being erroneously added to the
post.
See #30615.
git-svn-id: https://develop.svn.wordpress.org/trunk@31392 602fd350-edb4-49c9-b593-d223f7449a82
* Introduce WP_Customize_Manager::add_dynamic_settings() to register dynamically-created settings.
* Introduce `customize_dynamic_setting_args` filter to pass an array of args to a dynamic setting's constructor.
* Add unit tests for WP_Customize_Manager and WP_Customize_Widgets.
* See WP_Customize_Widgets as an example.
props westonruter.
fixes#30936.
git-svn-id: https://develop.svn.wordpress.org/trunk@31370 602fd350-edb4-49c9-b593-d223f7449a82
It's possible to have an empty `tax_query` and `is_tax=true` when the initial
query contains a taxonomy var (and is processed as such during
`WP_Query::parse_query()`) but the taxonomy var is unset during a 'parse_query'
callback. While this kind of behavior is not necessarily something we need to
support, we should continue to avoid PHP notices in such cases, as we did prior
to WP 4.1.
Fixes#31246.
git-svn-id: https://develop.svn.wordpress.org/trunk@31366 602fd350-edb4-49c9-b593-d223f7449a82
When editing a post, non-hierarchical taxonomy terms are sent as the
comma-separated list entered into the tax_input metabox. Passing these
values directly to `wp_update_post()` meant that they were interpreted as
term slugs rather than term names, causing mismatches when a typed string
matched the slug of one term and the name of a different term. We fix the
problem by preprocessing tax_input data sent from post.php, converting it to
unambiguous term_ids before saving.
Props boonebgorges, ArminBraun.
Fixes#30615.
git-svn-id: https://develop.svn.wordpress.org/trunk@31359 602fd350-edb4-49c9-b593-d223f7449a82
This patch also resizes some indexes, to allow for the 767 byte index size limit in standard MySQL installs.
See #21212
git-svn-id: https://develop.svn.wordpress.org/trunk@31349 602fd350-edb4-49c9-b593-d223f7449a82
When terms are entered into the database, term fields are sanitized with
`sanitize_term_field()`. To ensure that the `SELECT ... WHERE` queries in
`WP_Tax_Query::transform_query()` are not broken by overzealous sanitization,
`sanitize_term_field()` should be used in that case as well. This fixes a bug
where a tax_query using 'field=name' would fail if the 'terms' parameter
contained characters (like spaces) that were improperly removed by
`sanitize_title_for_query()`.
Fixes#27810.
git-svn-id: https://develop.svn.wordpress.org/trunk@31346 602fd350-edb4-49c9-b593-d223f7449a82
The implementation of `meta_query` orderby introduced in [31312] put clause
identifiers into a 'name' parameter of the clause. For greater clarity, this
changeset updates the syntax to use the associative array key used when
defining `meta_query` parameters, instead of the 'name' parameter.
Props Funkatronic, DrewAPicture.
Fixes#31045.
git-svn-id: https://develop.svn.wordpress.org/trunk@31340 602fd350-edb4-49c9-b593-d223f7449a82
The syntax previously used - `call_user_func( 'foo' )['bar']`, where `foo()`
returns an array - is not valid on all supported versions of PHP, and was
breaking the CI builds.
See #30988.
git-svn-id: https://develop.svn.wordpress.org/trunk@31339 602fd350-edb4-49c9-b593-d223f7449a82
This parameter allows developers to choose the post field that will be used to
fill in the 'option' attribute of the generated dropdown markup.
See [31006] #30306 for a parallel enhancement in `wp_dropdown_categories()`.
Props jfarthing84.
Fixes#12494.
git-svn-id: https://develop.svn.wordpress.org/trunk@31338 602fd350-edb4-49c9-b593-d223f7449a82
There was regression introduced by #28580 where only changed (dirty) settings now are POST'ed to the Customizer preview.
* Allow WP_Customize_Manager::post_value() to accept a second $default argument.
* Introduce WP_Customize_Manager::unsanitized_post_values() for accessing previously-private member variable _post_values.
* Do require_once instead of require for Customizer classes.
* Add unit tests for WP_Customize_Manager and WP_Customize_Setting.
props westonruter.
fixes#30988.
git-svn-id: https://develop.svn.wordpress.org/trunk@31329 602fd350-edb4-49c9-b593-d223f7449a82
In [31114], `get_permalink()` was modified to prevent pretty permalinks from
being generated for posts with the 'future' post status. This inadvertently
broke the pretty permalink preview for scheduled posts. The fix is to include
the 'future' status in the list of statuses that `get_sample_permalink()` fakes
as 'publish' before it fetches a permalink.
Props DrewAPicture.
Fixes#30910.
git-svn-id: https://develop.svn.wordpress.org/trunk@31323 602fd350-edb4-49c9-b593-d223f7449a82
This makes it possible to, for example, retrieve a specific post using the
`p` parameter of `WP_Query`, even if the post is in the Trash, by including
the `post_status=trash` parameter.
Props ebinnion.
Fixes#29167.
git-svn-id: https://develop.svn.wordpress.org/trunk@31321 602fd350-edb4-49c9-b593-d223f7449a82
The UI for these taxonomies was hidden in [31308], but it remained possible to
send a direct POST request to the `inline-edit` endpoint to bypass the
restriction. The current changeset fixes this.
Props meloniq.
Fixes#26948.
git-svn-id: https://develop.svn.wordpress.org/trunk@31313 602fd350-edb4-49c9-b593-d223f7449a82
`WP_Meta_Query` clauses now support a 'name' parameter. When building a
`WP_Query` object, the value of 'orderby' can reference this 'name', so that
it's possible to order by any clause in a meta_query, not just the first one
(as when using 'orderby=meta_value'). This improvement also makes it possible
to order by multiple meta query clauses (or by any other eligible field plus
a meta query clause), using the array syntax for 'orderby' introduced in [29027].
Props Funkatronic, boonebgorges.
Fixes#31045.
git-svn-id: https://develop.svn.wordpress.org/trunk@31312 602fd350-edb4-49c9-b593-d223f7449a82
Setting 'show_in_quick_edit' to false when registering a custom taxonomy will
hide the taxonomy when editing posts using Quick Edit.
The new 'quick_edit_show_taxonomy' filter allows this behavior to be filtered
on a finer scale, as when you want a given taxonomy to be hidden for one post
type but not for others.
Props hlashbrooke.
Fixes#26948.
git-svn-id: https://develop.svn.wordpress.org/trunk@31307 602fd350-edb4-49c9-b593-d223f7449a82
These methods provide a procedural alternative to the `@expectedDeprecated`
and `@expectedIncorrectUsage` test annotations, and parallel PHPUnit's native
`setExpectedException()`.
Props prasoon2211, jdgrimes.
Fixes#28486.
git-svn-id: https://develop.svn.wordpress.org/trunk@31306 602fd350-edb4-49c9-b593-d223f7449a82
Uncached results pulled from `wp_get_object_terms()` are zero-indexed (ie 0,
1, 2...). As a result, `get_the_terms()` was returning a strictly different
array when pulling from the cache and when the cache was empty.
Props joshlevinson.
Fixes#31086.
git-svn-id: https://develop.svn.wordpress.org/trunk@31287 602fd350-edb4-49c9-b593-d223f7449a82
`meta_query` tests have been moved to `tests/phpunit/tests/query/metaQuery.php` and `tax_query` tests to `tests/phpunit/tests/query/taxQuery.php`. This is an improvement because (a) it better corresponds to the way that other `WP_Query` parameter tests are organized, (b) splitting meta and tax tests into separate classes simplifies the required `@group` annotations, and (c) the tests have nothing to do with posts per se, and so do not belong in the `post` subdirectory.
The tests previously found at `tests/phpunit/tests/query/taxQuery.php` have been moved to `isTerm.php` in the same directory. These tests are related to the `is_*` functions that have to do with taxonomy terms, like `is_category()`.
See #26999.
git-svn-id: https://develop.svn.wordpress.org/trunk@31286 602fd350-edb4-49c9-b593-d223f7449a82
Previously, attempts to descend the family tree of each term were done using
the first taxonomy in the `$taxonomies` array, with the result that terms not
belonging to that taxonomy were not found and their children not properly
parsed. We fix this bug by fetching each term's taxonomy with the SQL query,
and then using that taxonomy to get the correct children for each term.
Fixes#31118.
git-svn-id: https://develop.svn.wordpress.org/trunk@31285 602fd350-edb4-49c9-b593-d223f7449a82
These tests fail on multisite if run after a test that creates
`wpmu_create_blog()`, because `wpmu_create_blog()` defines `WP_INSTALLING`,
which results in unexpected cache misses. See [28965] for a similar fix.
git-svn-id: https://develop.svn.wordpress.org/trunk@31280 602fd350-edb4-49c9-b593-d223f7449a82
The test uses the `_block_comments()` method to prevent comment inserts from
happening. Since [31263], failed comment inserts lead to the comment content's
being stripped of invalid characters and inserted again. By immediately
unhooking itself after first being run, `_block_comments()` was causing the
INSERT block to work only for the first attempt, while the second attempt was
going through, causing the test to fail. As a fix, we move the
`remove_filter()` call to the class's `tearDown()` method - sufficient for
cleanup, but late enough that *all* comment inserts will be blocked for the
test method in question.
See #21212.
Since [31263], comment INSERT queries that were pseudo-bl
git-svn-id: https://develop.svn.wordpress.org/trunk@31277 602fd350-edb4-49c9-b593-d223f7449a82
There is a pre-check in `get_terms()` that prevents an unnecessary database
query if the 'parent' or 'child_of' parameter is not found in the cached term
hierarchy (since a term without an index in the hierarchy cache has no
descendants). Previously, only the first item in the `$taxonomies` array was
being checked, with the result that an empty array was being erroneously
returned in cases where the 'parent' or 'child_of' term is in a subsequent
taxonomy.
See #31118.
git-svn-id: https://develop.svn.wordpress.org/trunk@31276 602fd350-edb4-49c9-b593-d223f7449a82
This new parameter allows developers to limit queried terms to terminal nodes -
ie, those without any descendants.
As part of the improvement, some internal logic in `get_terms()` has been
consolidated. Parameters that resolve to a NOT IN clause containing term IDs
('exclude', 'exclude_tree', and 'childless') are now parsed into a single
"exclusions" array before the SQL clause is generated.
Props theMikeD, horike.
Fixes#29839.
git-svn-id: https://develop.svn.wordpress.org/trunk@31275 602fd350-edb4-49c9-b593-d223f7449a82
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
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
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
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
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
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
* 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
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
[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
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
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
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
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
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
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
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
- 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
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
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
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
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
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
* 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
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
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
`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
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
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
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
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
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
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
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
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
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
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
* 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
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
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
`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
* 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
`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
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
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
* 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
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
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
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
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
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
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
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
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
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
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
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
* 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
`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
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
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
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
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
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
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
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
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
* 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
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
* 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
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
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
* 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
* 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
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
* 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
* 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
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
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
`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
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
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
* 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
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
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 #30080Fixes#30088
git-svn-id: https://develop.svn.wordpress.org/trunk@30007 602fd350-edb4-49c9-b593-d223f7449a82
* 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
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
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
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
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
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
`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
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
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
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
* 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
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