Commit Graph

2084 Commits

Author SHA1 Message Date
Peter Wilson
9ea1a7eb4f Posts: Fix back-compat for filters in get the modified time and date functions after [37738].
When no valid post exists for `get_the_modified_time` or `get_the_modified_date` calls, the result (`false`) is passed through the functions respective filters to maintain back-compat.

Introduces unit tests to ensure filters are applied and for the `get_the_modified_date` function.

Fixes #37059.


git-svn-id: https://develop.svn.wordpress.org/trunk@37866 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-26 11:29:13 +00:00
Boone Gorges
c97f234e6f Allow action and filter hooks to be deprecated.
When a filter or action hook is deprecated, the corresponding `apply_filters()`
or `do_action()` calls should be switched out with `apply_filters_deprecated()`
or `do_action_deprecated()`. The latter functions will throw a deprecation
before invoking the original hook.

Props solarissmoke, SergeyBiryukov, DrewAPicture.
Fixes #10441.

git-svn-id: https://develop.svn.wordpress.org/trunk@37861 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-25 19:56:19 +00:00
Boone Gorges
255aaa471e Fix orderby meta handling for WP_Term_Query.
In order to allow meta-related values of `orderby` to be handled properly,
the term query's `meta_query` object must run its `get_sql()` method before
`orderby` parsing.

Fixing this bug required addressing another bug in `WP_Meta_Query`, which
caused the table alias index not to be reset when calling `get_sql()`
multiple times on the same object.

Props littler.chicken.
Fixes #37151.

git-svn-id: https://develop.svn.wordpress.org/trunk@37860 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-25 16:22:55 +00:00
Pascal Birchler
bdaede85d7 Posts: Add hooks for post sticky status changes.
This adds a new `post_stuck` action that fires when a post is made sticky and a `post_unstuck` action that fires when the sticky flag is removed again.

Props ojrask.
Fixes #35600.

git-svn-id: https://develop.svn.wordpress.org/trunk@37857 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-23 15:51:03 +00:00
Pascal Birchler
d0555f9544 I18N: Enable unloading of text domains that have been loaded just in time.
[37415] removed the requirement to call `load_plugin_textdomain()` / `load_theme_textdomain()`. This caused `unload_textdomain()` to not work properly anymore in these cases.

With this change, unloaded text domains need to be explicitly loaded manually if you want to use them again.

Props swissspidy, ocean90.
Fixes #37113. See #34114.

git-svn-id: https://develop.svn.wordpress.org/trunk@37855 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-23 14:47:44 +00:00
Dominik Schilling (ocean90)
a35a1a9c75 I18N: Add support for the Catalan flown dot in remove_accents().
Props xavivars, SergeyBiryukov.
Fixes #37086.

git-svn-id: https://develop.svn.wordpress.org/trunk@37853 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-23 13:27:32 +00:00
Joe McGill
93cae978dd Media: Improve handling of extensionless filenames.
This ensures files retain a filename after sanitization.

Fixes 37111.

git-svn-id: https://develop.svn.wordpress.org/trunk@37756 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-21 13:43:59 +00:00
Pascal Birchler
3f050f87c3 Menus: Support nested array variables in POST data when saving menus.
[36510] allowed larger menus to be created in the Edit Menu screen by JSON-encoding the entire form into a single input field. However, it did not correctly handle nested arrays.

This introduces a new `_wp_expand_nav_menu_post_data()` helper function to handle this POST data which uses `array_replace_recursive()` internally. Since the latter is only available on PHP 5.3+, we add a compatibility function to ensure PHP 5.2 support.

Props ericlewis, neverything, swissspidy.
Fixes #36590 for trunk. See #14134.

git-svn-id: https://develop.svn.wordpress.org/trunk@37748 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-19 12:24:23 +00:00
Pascal Birchler
d40f2eed2c Permalinks: Validate custom permalink structures.
Custom permalink structures require at least one valid structure tag, e.g. `%postname%`. If none is included, it would leave users with broken permalinks.
Let's make sure this won't happen by validating the permalink structure.

Adds unit tests.

Props rockwell15 for initial patch.
Fixes #35936.

git-svn-id: https://develop.svn.wordpress.org/trunk@37747 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-19 12:01:11 +00:00
Pascal Birchler
db843d80ab L10n: Add unit tests for the override_load_textdomain filter.
Fixes #36398.

git-svn-id: https://develop.svn.wordpress.org/trunk@37746 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-18 10:09:26 +00:00
Peter Wilson
54f1c097a6 Posts: Add $post parameter to modified date and time functions.
Unifies the APIs for getting a post's modified date or time with getting a post's date or time.

Adds the `$post` parameter to the functions `get_the_modified_date` and `get_the_modified_time`.

Adds the `$post` parameter to the filters `get_the_modified_date` and `get_the_modified_time`.

Props Soean, lukecavanagh.
Fixes #37059.


git-svn-id: https://develop.svn.wordpress.org/trunk@37738 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-17 05:11:29 +00:00
Jeremy Felt
96d7eadb0c Multisite: Use WP_Site_Query to power WP_MS_Sites_List_Table.
`WP_Site_Query` provides for a cleaner `prepare_items()` method. It significantly improves the search experience in the sites list table:

* In a subdomain configuration, domain and path are searched for a provided terms.
* In a subdirectory configuration, path is searched for a provided term.
* The full domain is searched in a subdomain configuration rather than the portion not matching the network's domain.
* Terms are searched as `%term%` by default. Adding `*` in the middle of a term will search `%te%rm%`.

Props flixos90, Fab1en.
Fixes #33185, #24833, #21837, #36675.


git-svn-id: https://develop.svn.wordpress.org/trunk@37736 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-17 00:02:05 +00:00
Jeremy Felt
3d56328372 Multisite: Add search column support to WP_Site_Query.
`domain` and/or `path` can be used to specify which column(s) should be searched.

See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37735 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-16 23:08:30 +00:00
Pascal Birchler
931440e375 Embeds: Enforce a valid post ID when embedding a post from the current site.
Otherwise `wp_filter_pre_oembed_result()` could erroneously return the HTML of the current post instead of the intended result.

Props kraftbj.
See #36767.

git-svn-id: https://develop.svn.wordpress.org/trunk@37729 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-16 17:17:32 +00:00
Rachel Baker
7a4e523b5e REST API: Include X-Robots-Tag: noindex header in REST API responses to prevent endpoints from being indexed by search engines.
Prevent duplicate content issues with search engines and REST API endpoint response data.

Fixes #36390.
Props m_uysl for the initial patch.

git-svn-id: https://develop.svn.wordpress.org/trunk@37726 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-16 14:58:28 +00:00
Dominik Schilling (ocean90)
62bd8ecdd7 External Libraries: Update Backbone to version 1.3.3.
Changelog: https://cdn.rawgit.com/jashkenas/backbone/1.3.3/index.html#changelog
Diff: https://github.com/jashkenas/backbone/compare/1.2.3...1.3.3

Includes a unit test to ensure that the minified version doesn't include `sourceMappingURL`.

Props adamsilverstein.
Fixes #37099.

git-svn-id: https://develop.svn.wordpress.org/trunk@37723 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-16 09:26:06 +00:00
Boone Gorges
e1cfb25e79 Query: set_found_posts() must run immediately after main query.
If not run immediately after, the `SELECT FOUND_ROWS()` query might refer to
a different query, such as the one used to populate the post cache for a split
query.

Introduced in [37692].

Fixes #36687.

git-svn-id: https://develop.svn.wordpress.org/trunk@37721 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-16 02:00:02 +00:00
Sergey Biryukov
983d5c94e8 Plugins: Normalize WP_PLUGIN_DIR in the test added in [37332], otherwise it fails on Windows.
See #29154.

git-svn-id: https://develop.svn.wordpress.org/trunk@37719 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 18:30:32 +00:00
Sergey Biryukov
25a27bff7d I18N: Revert the test added in [37716], as it causes errors when running the full suite.
See #36790.

git-svn-id: https://develop.svn.wordpress.org/trunk@37718 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 18:04:31 +00:00
Sergey Biryukov
6a5305e0b1 I18N: Add a unit test for wp_maybe_decline_date().
See #36790.

git-svn-id: https://develop.svn.wordpress.org/trunk@37716 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 17:40:23 +00:00
Konstantin Obenland
4dd1d9bef9 Update/Install: Shiny Updates v2.
Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.

Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.



git-svn-id: https://develop.svn.wordpress.org/trunk@37714 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 16:36:07 +00:00
Rachel Baker
1d115078eb Comments: Do not flag a comment as a duplicate if the comment_author_email is provided but not a match.
This reduces the strictness of the duplicate check a little, but does prevent false duplicates for emoji or +1 comments by authors with matching names. The current logic was introduced all the way back in [2894].

Fixes #37093.

git-svn-id: https://develop.svn.wordpress.org/trunk@37713 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 14:50:38 +00:00
Boone Gorges
ade41fc2cf Query: After [37692], don't skip set_found_posts() when no posts are found.
The 'found_posts' filter must continue to run for plugins manipulating post
results via filter.

Props dd32.
Fixes #36687.

git-svn-id: https://develop.svn.wordpress.org/trunk@37712 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 12:32:25 +00:00
Pascal Birchler
3c34040bf2 Fix tests after [37708].
See #36767.

git-svn-id: https://develop.svn.wordpress.org/trunk@37710 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 11:54:28 +00:00
Pascal Birchler
b2671c3880 Embeds: Improve performance when embedding a post from the current site.
When the post being embedded is from the same site, there's no reason to do an HTTP request for it. The data can be fetched directly using `get_oembed_response_data()`.

Fixes #36767 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@37708 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-15 11:22:52 +00:00
Sergey Biryukov
661f5a477e After [37702], correct the expected result in test_size_format().
See #37037.

git-svn-id: https://develop.svn.wordpress.org/trunk@37705 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 22:12:35 +00:00
SergeyBiryukov
aea4c0d86a In size_format() and wp_convert_bytes_to_hr(), replace kB with KB for consistency with other units.
Props Presskopp, dashaluna.
Fixes #37037.

git-svn-id: https://develop.svn.wordpress.org/trunk@37702 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 21:40:02 +00:00
Weston Ruter
f26ccf6fac Customize: Update server-sent setting validation notifications as changes are entered.
Send back setting validities with full refreshes and selective refreshes so that invalid settings can have notifications displayed immediately before attempting save, and so that these notifications can be cleared as soon as the input is corrected.

* Splits out JS logic for listing controls into separate methods  `wp.customize.Setting.prototype.findControls()` and `wp.customize.findControlsForSettings()`.
* Adds a `setting` property to the `data` on notifications added to controls that are synced from their settings.
* Adds `selective-refresh-setting-validities` message sent from preview to pane.
* Changes `WP_Customize_Manager::validate_setting_values()` to return when settings are valid as well as invalid.
* Adds `WP_Customize_Manager::prepare_setting_validity_for_js()`.
* Add setting validities to data exported to JS in Customizer Preview and in selective refresh responses.

Fixes #36944.


git-svn-id: https://develop.svn.wordpress.org/trunk@37700 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 19:16:54 +00:00
Boone Gorges
becae4f492 Query: Allow plugins to supply post results instead of having WP_Query fetch them from the database.
Returning a non-null value from the new `posts_pre_query` filter will cause
`WP_Query` to skip its database query, so that posts data can be provided from
elsewhere. This is useful in cases where post data may be mirrored in a
separate location, such as an external search application.

Developers should note that the `WP_Query` properties generally used to
calculate pagination - specifically, `found_posts` and `max_num_pages`, which
are determined by default in `set_found_posts()` - must be provided explicitly
when using the `posts_pre_query` filter; since `WP_Query` will not be
contacting the database, it will have no access to `SELECT FOUND_ROWS()`.
The `WP_Query` instance is passed to `posts_pre_query` by reference, so that
these properties can be set manually if needed.

Props jpdavoutian, tlovett1.
Fixes #36687.

git-svn-id: https://develop.svn.wordpress.org/trunk@37692 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-14 01:59:25 +00:00
Dominik Schilling (ocean90)
979660717e Canonical: Introduce wp_get_canonical_url().
`wp_get_canonical_url()` encapsulates the URL logic of `rel_canonical()` to provide a consistent way to retrieve the canonical URL for a post.
The new filter `get_canonical_url` allows to customize the canonical URL.

Props joostdevalk, jipmoors, DrewAPicture, ocean90.
Fixes #36168.

git-svn-id: https://develop.svn.wordpress.org/trunk@37685 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 13:30:23 +00:00
Boone Gorges
b9d46425c0 Introduce term_taxonomy_id parameter for WP_Term_Query.
Allows the fetching of terms based on `term_taxonomy_id`, or an array of
`term_taxonomy_ids`.

Props spacedmonkey.
Fixes #37074.

git-svn-id: https://develop.svn.wordpress.org/trunk@37683 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 03:48:03 +00:00
Boone Gorges
beebded867 Tests: Move WP_Tax_Query tests to a more appropriate file.
The file they were living in is the rightful home of `WP_Term_Query` tests.

See #37074.


git-svn-id: https://develop.svn.wordpress.org/trunk@37682 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-11 03:26:07 +00:00
Ella Iseulde Van Dorpe
644795a9dc TinyMCE: wptextpattern: fix for fast typing
Props jnylen0, iseulde.

Fixes #36585.



git-svn-id: https://develop.svn.wordpress.org/trunk@37668 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 19:06:25 +00:00
Jeremy Felt
363533d9b3 Multisite: Use to_array() method on WP_Site objects in wp_get_sites()
When an object with private properties is cast directly to an array, those properties are no longer available with their original keys.

Props @flixos90.
See #36717.


git-svn-id: https://develop.svn.wordpress.org/trunk@37667 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 18:09:25 +00:00
Jeremy Felt
56c98dd30a Tests: Split get_blog_details() test into individual tests
* One test per method
* Clarify existing tests.
* Add test for passing a "blog slug" string to `get_blog_details()`.
* Shared fixture of sites.
* Reduce number of sites created to only those necessary.
* Remove unnecessary networks creation.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37666 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 15:57:37 +00:00
Jeremy Felt
ead348053b Tests: Move get_blog_details() tests to their own file
See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37665 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 05:40:45 +00:00
Jeremy Felt
8de500d493 Tests: User a data provider for wp_get_sites() tests.
* Convert existing tests into a data provider and clarify expectations.
* Add shared test fixtures in preparation for future tests.

This passes with the `wp_get_sites()` from 4.5 and the deprecated version in trunk.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37662 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-09 00:27:46 +00:00
Jeremy Felt
8e380e50d8 Tests: Move wp_get_sites() tests to their own file
See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37660 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 22:46:38 +00:00
Boone Gorges
ca05a4b43d Comments: In wp_list_comments(), queries with custom pagination params should obey default comment_status logic.
When custom pagination parameters are passed to `wp_list_comments()`, a
secondary query must be performed to fetch the proper comments. See [36157].
This query should show comments of the same `comment_status` as the default
query initialized in `comments_template()`: show only comments that are
approved, or those that are unapproved but belong to the current user.

Props smerriman.
Fixes #37048.

git-svn-id: https://develop.svn.wordpress.org/trunk@37655 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 04:00:18 +00:00
Gary Pendergast
5c4a15d0fc Tests: Disable foreign_key_checks while dropping existing tables.
To ensure a clean run, the test suite drops all tables before installing, by simply looping over the table list and dropping them if they exist. This works well for Core, but may fail when a plugin has created a table with foreign key constraints in a previous test run.

Many plugins choose to base their test suite on the Core setup, so making life easier for them is a plus, even if Core doesn't directly need this change.

Props javorszky.

Fixes #37046.



git-svn-id: https://develop.svn.wordpress.org/trunk@37654 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 03:03:16 +00:00
Jeremy Felt
6da085cfe4 Multisite: Deprecate wp_get_sites()
Defer to the new `get_sites()` replacement, offering fresh (...or cached) `WP_Site` objects via the new `WP_Site_Query`.

Props flixos90.
Fixes #36994.


git-svn-id: https://develop.svn.wordpress.org/trunk@37653 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-08 03:02:34 +00:00
Boone Gorges
a1e19248a3 Tests: Compare wp_set_object_terms() results using term_taxonomy_id.
`term_id` and `term_taxonomy_id` become offset when running the entire test
suite.

Introduced in [37647].

See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37649 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 23:42:43 +00:00
Dominik Schilling (ocean90)
30b1f09c21 Widgets: Revert [37425] and [37427].
The change can cause fatal errors under certain conditions, like when the subclass has a different function signature for `widget()` or doesn't even implement the method.

See #35981.

git-svn-id: https://develop.svn.wordpress.org/trunk@37648 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:50:29 +00:00
Boone Gorges
8d40956f7a Tests: Add tests demonstrating wp_set_object_terms() behavior when matching $terms.
See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37647 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:34:22 +00:00
Rachel Baker
25c3618138 REST API: Create the general wp_check_jsonp_callback() function for validating JSONP callback functions.
Move the REST API JSONP callback validation check into a separate function named `wp_check_jsonp_callback()`. This allows plugins to use the built-in validation when handling JSONP callbacks.
Extremely Important Note: If you send JSONP in your custom response, make sure you prefix the response with `/**/`. This will mitigate the Rosetta Flash exploit. You should also send the `X-Content-Type-Options:nosniff` header, or even better, use the REST API infrastructure.

Props rmccue.
Fixes #28523.

git-svn-id: https://develop.svn.wordpress.org/trunk@37646 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:33:30 +00:00
Boone Gorges
cc7d91f141 Tests: Move wp_set_object_terms() tests to their own file.
This is a redo of [37642], this time not done in the not right place.

See #37009.


git-svn-id: https://develop.svn.wordpress.org/trunk@37644 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:22:43 +00:00
Boone Gorges
b189d26960 Add test demonstrating that wp_insert_term() will suffix a slug if the new term's auto-generated slug matches that of an existing term.
See #37009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37641 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-06 21:03:34 +00:00
Boone Gorges
a77ffd8e83 Taxonomy: No, really, don't pass results of 'count' query through 'get_terms' filter.
[37623] used the wrong parameter name (count=true instead of fields=count).

For greater flexibility and forward compatibility with other potential changes
to the return value of `get_terms()`, we now do a looser check: any non-array
value is excluded from the filter.

Fixes #36992.

git-svn-id: https://develop.svn.wordpress.org/trunk@37634 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-04 12:19:15 +00:00
Jeremy Felt
91859d2098 Multisite: Add initial tests for WP_MS_Sites_List_Table
Different tests are used for subdomain and subdirectory installs as domain and path are searched differently for each. Only trailing wildcard searches are tested because leading wildcards are not yet supported.

See #36675.


git-svn-id: https://develop.svn.wordpress.org/trunk@37633 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-03 14:38:01 +00:00
Boone Gorges
9f21bd49bc Add tests for remove_query_arg().
Props borgesbruno.
Fixes #37008.

git-svn-id: https://develop.svn.wordpress.org/trunk@37631 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-03 04:30:23 +00:00
Andrew Ozz
245709dcd1 Auto-embedding:
- We already match URLs on their own line, add another regex to match URLs in their own paragraphs.
- Always exclude the `\s<>"` characters when matching.
- Add more unit tests.

Props iseulde, azaozz.
Fixes #25387.

git-svn-id: https://develop.svn.wordpress.org/trunk@37627 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 21:23:43 +00:00
Boone Gorges
1f5147bf83 Comments: Improve caching for hierarchical queries.
Hierarchical comment queries work by first fetching the IDs of top-level
comments, and then filling the descendant tree one level at a time based on the
top-level results. When top-level comment IDs are found in the cache,
`WP_Comment_Query` does not generate the SQL used to fetch these comments. In
this case, the `fill_descendants()` query does not have enough information
to fill children. As a result, descendant comments were failing to be filled
in cases where the top-level comments were found in the cache.

This was a minor bug previously, because comment caches were not maintained
between pageloads. Since comment caches are now persistent [37613], the problem
becomes evident anywhere that a persistent object cache is in use.

The solution is to cache parent-child relationships, so that when top-level
comments are found in the cache, descendant comments should be found there as
well.

Fixes #36487.

git-svn-id: https://develop.svn.wordpress.org/trunk@37625 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 18:27:43 +00:00
Boone Gorges
f6a2067d37 Taxonomy: Don't pass results of 'count' query through 'get_terms' filter.
Use of the 'get_terms' filter was consolidated in [37572], with the
introduction of `WP_Term_Query`. At that time, the result of 'count=true'
queries began being filtered by 'get_terms'. This breaks existing 'get_terms'
callbacks, which often assume that the returned value will be an array or a
`WP_Error` object.

Props JustinSainton.
Fixes #36992.

git-svn-id: https://develop.svn.wordpress.org/trunk@37623 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-02 14:37:55 +00:00
Boone Gorges
04d01a8eb4 Add tests demonstrating individual comment cache invalidation.
See #36906.

git-svn-id: https://develop.svn.wordpress.org/trunk@37609 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 17:15:27 +00:00
Boone Gorges
425fffeb4f Add tests demonstrating query cache invalidation on comment CRUD actions.
See #36909.

git-svn-id: https://develop.svn.wordpress.org/trunk@37608 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 16:59:16 +00:00
Gary Pendergast
0e8e778af9 Tests: Fix an incorrect @ticket header introduced in [37601].
See #32405, #36917.



git-svn-id: https://develop.svn.wordpress.org/trunk@37602 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 02:40:19 +00:00
Gary Pendergast
bc975d28d4 Database: Split the logic of wpdb::init_charset() into a separate method.
The logic for determining the appropriate character set and collation to use is becoming more complex, particularly with the recent additions of [37522] and [37523]. As `init_charset()` has side effects, and makes use of constants instead of parameters, it's not possible to unit test this logic.

This commit splits the logic part of `init_charset()` out into a new method, `wpdb::determine_charset()`, along with appropriate unit tests.

See #32105, #37522.

Fixes #36917.



git-svn-id: https://develop.svn.wordpress.org/trunk@37601 602fd350-edb4-49c9-b593-d223f7449a82
2016-06-01 02:37:20 +00:00
Boone Gorges
5fdf2b4b44 Add tests for no_found_rows behavior of WP_Query.
See #29952.

git-svn-id: https://develop.svn.wordpress.org/trunk@37600 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-31 19:28:46 +00:00
Boone Gorges
9b19a33952 Ensure that get_terms() can accept querystring-style arguments.
Prior to [37572], arguments passed to `get_terms()` were passed immediately
through `wp_parse_args()`, which made it possible to pass arguments as a
querystring (`hide_empty=0`) rather than an array
(`array( 'hide_empty' => false )`). [37572] moved default argument parsing
into `WP_Term_Query`, while assuming that arguments passed to `get_terms()`
would be formatted as an array.

To provide compatibility, we now parse all args passed to `get_terms()` into
an array before processing.

See #35381.

git-svn-id: https://develop.svn.wordpress.org/trunk@37599 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-31 12:53:27 +00:00
Boone Gorges
8f06d6678b Tests: Change some 'group' annotations to 'ticket'.
git-svn-id: https://develop.svn.wordpress.org/trunk@37595 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-30 04:37:57 +00:00
Boone Gorges
cb5b8479f0 In WP_Meta_Query, don't cast meta_value to CHAR.
`CHAR` is redundant, since the `meta_value` column is `LONGTEXT`. Meanwhile,
use of `CAST()` causes MySQL to ignore any index that the administrator may
have added to the column.

A number of automated tests were doing searches for `CAST` in the SQL strings
generated by `WP_Meta_Query` (for reasons unrelated to the `CAST()` behavior).
These tests have been updated to expect the new query format.

Props ericlewis.
Fixes #36625.

git-svn-id: https://develop.svn.wordpress.org/trunk@37594 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-30 04:35:16 +00:00
Boone Gorges
23d0c953d2 Don't clear object relationship caches on term update.
Since [37573], object relationship caches (`{$taxonomy}_relationships`)
contain term IDs rather than term objects. See #36814. As such, it's no longer
necessary to clear these caches when a term is updated; none of the data that's
changed on update (name, description, count, etc) is stored in the relationship
cache.

Fixes #36251.

git-svn-id: https://develop.svn.wordpress.org/trunk@37593 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-30 04:10:16 +00:00
Boone Gorges
c96858b0f2 Allow term meta lazy-loading to be selectively disabled in WP_Query.
The process of lazy-loading can be resource intensive for object that have
terms in large numbers of taxonomies and are running a persistent object cache.
This new parameter allows the feature to be disabled in these cases.

Props DBrumbaugh10Up.
See #36953.

git-svn-id: https://develop.svn.wordpress.org/trunk@37589 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-28 03:09:09 +00:00
Aaron Jorbin
13350c95e4 Bootstrap/Load: Load plugin.php earlier in wp-settings.php
In order to allow non-web initializations of WordPress (such as through wp-cli) to modify things like the check for maintenance mode, plugins.php and the associated functions must be available much earlier. The use of these functions earlier than the loading of plugins is not recommended in most use cases.

Fixes #36819. See #34936.
Props jorbin, danielbachhuber for documentation.


git-svn-id: https://develop.svn.wordpress.org/trunk@37588 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-27 19:19:12 +00:00
Dominik Schilling (ocean90)
35a7acb459 Database: Normalize index definitions in dbDelta().
`dbDelta()` compares the index definitions against the result of `SHOW INDEX FROM $table_name`. This requires a specific format so indices are not unnecessarily re-created. This format wasn't ensured, until now.

* Parse the raw index definition to extract the type, name and columns so a normalized definition can be built (#20263, #34873).
* Standardize on uppercase types (#34871) and on 'KEY'. 'INDEX' is only a synonym for 'KEY'.
* Escape index names with backticks (#20263).
* Normalize columns: Ignore ASC and DESC definitions (#34959), remove whitespaces (#34869) and escape column names with backticks (#20263).
* Add backticks to all index change queries (#20263).

Props ocean90, pento, kurtpayne.
Fixes #20263, #34869, #34871, #34873, #34959.

git-svn-id: https://develop.svn.wordpress.org/trunk@37583 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-27 11:56:20 +00:00
Boone Gorges
2c7f879188 Add tests for get_weekstartend().
Props pbearne, tloureiro.
Fixes #36415.

git-svn-id: https://develop.svn.wordpress.org/trunk@37579 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-26 15:47:52 +00:00
Gary Pendergast
a51a68fb75 Database: Add support for SPATIAL keys to dbDelta().
`dbDelta()` already supported spatial fields (by virtue of not checking field types), so it's nice to round that out with spatial key support, too.

Fixes #36948.



git-svn-id: https://develop.svn.wordpress.org/trunk@37574 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-26 04:58:13 +00:00
Boone Gorges
96b71d7d89 Store only term IDs in object term relationships caches.
Previously, objects containing all data about a term were stored in each
object's term cache. Besides being wasteful, this approach caused invalidation
issues, as when a modified term count required a flush for all objects
belonging to the term.

Backward compatibility is maintained for plugins that continue to put object
data directly into the `{$taxonomy}_relationships` cache bucket.

Fixes #36814.

git-svn-id: https://develop.svn.wordpress.org/trunk@37573 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-26 04:49:10 +00:00
Boone Gorges
a378749df6 Fix termmeta pre-fetching in wp_get_object_terms().
[34529] introduced logic intended to prime the termmeta cache for certain
values of the `fields` parameter. There were a few bugs:

* The `all_with_object_id` param was misspelled.
* `term_id` was used instead of `ids`.
* The values being passed to `update_termmeta_cache()` in the case where `fields=ids` was not correct.

All of these would result in a failure to pre-fetch termmeta in some cases.

Props dlh.
Fixes #36932.

git-svn-id: https://develop.svn.wordpress.org/trunk@37567 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:44:00 +00:00
Drew Jaynes
c013727ebe Posts: Add test coverage for get_preview_post_link().
Props swissspidy.
Fixes #35915.


git-svn-id: https://develop.svn.wordpress.org/trunk@37566 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:30:57 +00:00
Boone Gorges
1d3511ba8c In get_bookmarks(), don't cache if 'orderby=rand'.
Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe.
Fixes #18356.

git-svn-id: https://develop.svn.wordpress.org/trunk@37565 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:29:01 +00:00
Boone Gorges
ec53bf5bf6 Add tests for get_bookmarks() cache.
This changeset adds a unit test factory so that bookmark/link fixtures can be
created during tests.

Why are we writing tests for functionality that has been deprecated for years?
Because it's the Right Thing to Do.

See #18356.

git-svn-id: https://develop.svn.wordpress.org/trunk@37563 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:20:24 +00:00
Ella Iseulde Van Dorpe
e20bc6cc46 Media: adjust test after [37556]
See #36888.



git-svn-id: https://develop.svn.wordpress.org/trunk@37557 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 14:05:34 +00:00
Dominik Schilling (ocean90)
52caa1f06a Database: Support backticks around field names when parsing a query for the field type.
Avoids an undefined index PHP warning by `dbDelta()`.

Props davidmosterd, ocean90.
See #20263.

git-svn-id: https://develop.svn.wordpress.org/trunk@37538 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 18:11:32 +00:00
Gary Pendergast
2d14d5abab Database: dbDelta() will no longer try to downgrade the size of TEXT and BLOB columns.
When upgrading to `utf8mb4`, `TEXT` fields will be upgraded to `MEDIUMTEXT` (and likewise for all other `*TEXT` and `*BLOB` fields). This is to allow for the additional space requirements of `utf8mb4`.

On the subsequent upgrade, after the `utf8mb4` upgrade, `dbDelta()` would try and downgrade the fields to their original size again. At best, this it a waste of time, at worst, this could truncate any data larger than the original size. There's no harm in leaving them at their original size, so let's do that.

Fixes #36748.



git-svn-id: https://develop.svn.wordpress.org/trunk@37525 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 08:35:59 +00:00
Gary Pendergast
c231052280 Tests: Remove a test for a function that can't be tested.
`wpdb::init_charset()` doesn't lend itself to being tested, so the unit test added in [37521] won't work under most circumstances.

See #32405.



git-svn-id: https://develop.svn.wordpress.org/trunk@37522 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 06:26:01 +00:00
pento
4422aac17c Database: Obey locale-specific utf8 collation settings.
Some sites prefer to use locale-specific location settings. For example, the Swedish WordPress package use `utf8_swedish_ci`, instead of `utf8_unicode_ci`. When upgrading the connection to `utf8mb4`, we were overriding this to be `utf8mb4_unicode_ci`, instead of maintaining the use of the `_swedish_ci` variant.

The locale-specific collations do have extra collation rules just for that language, so it's useful to maintain compatibility.

Fixes #32405.




git-svn-id: https://develop.svn.wordpress.org/trunk@37521 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 05:53:02 +00:00
Boone Gorges
dd70966885 Tests: get_terms() 'search' test should have more precise fixtures..
Without a fixture that does not match the search term, it's possible for the
test to pass even if the search clause isn't built properly.

See #13992, #35381.

git-svn-id: https://develop.svn.wordpress.org/trunk@37519 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-23 03:25:51 +00:00
Boone Gorges
3e3b09c8ea In get_page_by_path(), values fetched from cache should obey $output param.
Introduced in [37479].

Props spacedmonkey.
Fixes #36711.

git-svn-id: https://develop.svn.wordpress.org/trunk@37481 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-22 16:18:22 +00:00
Boone Gorges
56a3d4bb65 Move get_the_terms() tests to their own file.
See #36814.


git-svn-id: https://develop.svn.wordpress.org/trunk@37480 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-21 17:56:40 +00:00
Boone Gorges
1a39a00dfd Cache queries in get_page_by_path().
Props spacedmonkey.
Fixes #36711.

git-svn-id: https://develop.svn.wordpress.org/trunk@37479 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-21 17:26:55 +00:00
Boone Gorges
70fece5c7e Tests: Improve tests for get_page_by_path().
* Move existing test into its own file.
* Add tests that cover most pieces of functionality.

See #36711.

git-svn-id: https://develop.svn.wordpress.org/trunk@37478 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-21 02:40:56 +00:00
Jeremy Felt
381930974c Multisite: Introduce WP_Site_Query
Provides a consistent way to query `$wpdb->blogs` for `WP_Site` objects based on domain, path, site ID, network ID, and more.

Introduces and uses `update_site_cache()` and `_prime_site_caches()` to maintain a cached list of `WP_Site` objects for use in multiple queries.

Props spacedmonkey, flixos90, DrewAPicture, jeremyfelt, ocean90.
See #35791.


git-svn-id: https://develop.svn.wordpress.org/trunk@37477 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 22:03:52 +00:00
Weston Ruter
c7ff79df64 Customize: Add setting validation model and control notifications to augment setting sanitization.
When a setting is invalid, not only will it be blocked from being saved but all other settings will be blocked as well. This ensures that Customizer saves aren't partial but are more transactional. User will be displayed the error in a notification so that they can fix and re-attempt saving.

PHP changes:

* Introduces `WP_Customize_Setting::validate()`, `WP_Customize_Setting::$validate_callback`, and the `customize_validate_{$setting_id}` filter.
* Introduces `WP_Customize_Manager::validate_setting_values()` to do validation (and sanitization) for the setting values supplied, returning a list of `WP_Error` instances for invalid settings.
* Attempting to save settings that are invalid will result in the save being blocked entirely, with the errors being sent in the `customize_save_response`. Modifies `WP_Customize_Manager::save()` to check all settings for validity issues prior to calling their `save` methods.
* Introduces `WP_Customize_Setting::json()` for parity with the other Customizer classes. This includes exporting of the `type`.
* Modifies `WP_Customize_Manager::post_value()` to apply `validate` after `sanitize`, and if validation fails, to return the `$default`.
* Introduces `customize_save_validation_before` action which fires right before the validation checks are made prior to saving.

JS changes:

* Introduces `wp.customize.Notification` in JS which to represent `WP_Error` instances returned from the server when setting validation fails.
* Introduces `wp.customize.Setting.prototype.notifications`.
* Introduces `wp.customize.Control.prototype.notifications`, which are synced with a control's settings' notifications.
* Introduces `wp.customize.Control.prototype.renderNotifications()` to re-render a control's notifications in its notification area. This is called automatically when the notifications collection changes.
* Introduces `wp.customize.settingConstructor`, allowing custom setting types to be used in the same way that custom controls, panels, and sections can be made.
* Injects a notification area into existing controls which is populated in response to the control's `notifications` collection changing. A custom control can customize the placement of the notification area by overriding the new `getNotificationsContainerElement` method.
* When a save fails due to setting invalidity, the invalidity errors will be added to the settings to then populate in the controls' notification areas, and the first such invalid control will be focused.

Props westonruter, celloexpressions, mrahmadawais.
See #35210.
See #30937.
Fixes #34893.


git-svn-id: https://develop.svn.wordpress.org/trunk@37476 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 21:09:40 +00:00
Jeremy Felt
757c0767f7 Multisite: Wrap the main bootstrap process in a function
Introduce `ms_load_current_site_and_network`. This is used by core during the multisite bootstrap process to populate the `$current_site` and `$current_blog` globals based on a requested domain and path.

Return values from this function inform `ms-settings.php` as to whether a page view should continue, `ms_not_installed()` should fire, or a redirect to a new location should occur.

This was previously a procedural block in `ms-settings.php`. Wrapping this code and providing specific return values allows us to write tests that do not rely on the manual and repeated inclusion of `ms-settings.php`.

This should not be used by plugins or themes. Please.

See #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37475 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 20:56:54 +00:00
Peter Wilson
761dde5ee9 Emoji: Use SVG in supported browsers
Use SVG images in supporting browsers, otherwise fall back to PNG images. Add the filters `emoji_svg_url` and `emoji_svg_ext`.

Introduces unit tests to check the Emoji CDN filters.

Fixes #36525


git-svn-id: https://develop.svn.wordpress.org/trunk@37471 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 06:02:55 +00:00
Gary Pendergast
8a779ede82 Tests: Fix an incorrect @ticket header included in [37469].
See #36122.



git-svn-id: https://develop.svn.wordpress.org/trunk@37470 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 05:29:50 +00:00
Gary Pendergast
6d963d60c6 Emoji: Allow emoji in blogname and blogdescription on utf8 installs.
When the options table is set to `utf8` instead of `utf8mb4`, emoji will be stripped from the blog name and description when they're saved. Instead of stripping them, they can be encode as HTML entities.

Fixes #36122.



git-svn-id: https://develop.svn.wordpress.org/trunk@37469 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-20 04:53:40 +00:00
Boone Gorges
63755028e8 Introduce required argument for wp_dropdown_categories().
This allows the HTML5 `required` attribute to be added to the `select` element.

Props wzislam, pcarvalho.
Fixes #31909.

git-svn-id: https://develop.svn.wordpress.org/trunk@37465 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-19 02:38:33 +00:00
Boone Gorges
510bbfcb9c Move wp_dropdown_categories() tests into their own file.
See #31909.


git-svn-id: https://develop.svn.wordpress.org/trunk@37464 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-19 02:22:59 +00:00
Aaron Jorbin
63cdf85fad Correct usage of @Covers for Tests_Post_Types
When @covers is used with a plain alphanumeric string, PHPUnit assumes that it is covering a class. If there is no class, it fails and exits rather than continuing to generate coverage. To cover a global function, the name must start with ::. See https://phpunit.de/manual/5.3/en/appendixes.annotations.html#appendixes.annotations.covers

Introduced in [36768].

Fixes #36867. See #35985



git-svn-id: https://develop.svn.wordpress.org/trunk@37459 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-18 17:13:11 +00:00
Aaron Jorbin
ead6585754 Correct usage of Covers for Tests_Update_Comment_Count_Now
When @covers is used with a plain alphanumeric string, PHPUnit assumes that it is covering a class. If there is no class, it fails and exits rather than continuing to generate coverage. To cover a global function, the name must start with ::. See https://phpunit.de/manual/5.3/en/appendixes.annotations.html#appendixes.annotations.covers

[37445] for trunk

See #35060, #36867



git-svn-id: https://develop.svn.wordpress.org/trunk@37447 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-17 20:19:50 +00:00
Boone Gorges
55961a5613 Tests: Use factory method to generate fixtures for wp_unique_post_slug() tests.
Props mintindeed.
See #20419.

git-svn-id: https://develop.svn.wordpress.org/trunk@37443 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-17 01:48:58 +00:00
Dominik Schilling (ocean90)
999af2444c I18N: In get_translations_for_domain() check if the global $l10n was set by _load_textdomain_just_in_time() before accessing it.
Props danielhuesken.
Fixes #34114.

git-svn-id: https://develop.svn.wordpress.org/trunk@37440 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-16 15:09:33 +00:00
Ryan McCue
9074e9f93b HTTP API: Replace internals with Requests library.
Requests is a library very similar to WP_HTTP, with a high level of unit test coverage, and has a common lineage and development team. It also supports parallel requests.

See #33055.


git-svn-id: https://develop.svn.wordpress.org/trunk@37428 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-13 04:41:45 +00:00
Dominik Schilling (ocean90)
e2329076f3 Widgets: Create WP_Widget_Mock as a mock of WP_Widget which can be used for widget tests.
You cannot instantiate an abstract class. Not even in WordPress world.

See #35981.

git-svn-id: https://develop.svn.wordpress.org/trunk@37427 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-12 21:24:18 +00:00
Jeremy Felt
4429638da6 Tests: Set public to 1 in the default blog factory
When no `$meta` arguments are passed to `wpmu_create_blog()`, `public` is set to `0` in the database for new sites. This is fine, but also does not match the default implied when most sites are created via `site-new.php`.

The only current use of the `$meta` argument in the tests is to (re)mark `public` as `0`. All existing tests pass with this change. Tests for `WP_Site_Query` can now rely on better default expectations.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37418 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-11 19:21:22 +00:00
Pascal Birchler
0151b0ebae I18N: Remove the requirement to call load_plugin_textdomain() / load_theme_textdomain().
By initially scanning the `wp-content/languages` directory and loading available MO files just-in-time, plugins and themes do not need to manually load text domains anymore.

Props swissspidy, ocean90.
Fixes #34114

git-svn-id: https://develop.svn.wordpress.org/trunk@37415 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-10 20:04:52 +00:00
Weston Ruter
8359290d8f Customize: Ensure that wp_setup_nav_menu_item filter applies consistently on nav_menu_item setting values.
The filter was being applied in `WP_Customize_Nav_Menu_Item_Setting::value()` but not in `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()`.

Props celloexpressions, westonruter.
Fixes #35203.


git-svn-id: https://develop.svn.wordpress.org/trunk@37405 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-10 06:40:48 +00:00
Dominik Schilling (ocean90)
41cfd4d826 Tests: Don't create unused users in Tests_Ajax_DeleteComment.
Fixes #36616.

git-svn-id: https://develop.svn.wordpress.org/trunk@37404 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-09 19:16:35 +00:00
Boone Gorges
f3ccef62be Users: The 'who' parameter should not interfere with 'meta_key' + 'meta_value' in WP_User_Query.
Props adrianosilvaferreira.
Fixes #36724.

git-svn-id: https://develop.svn.wordpress.org/trunk@37360 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-04 18:56:58 +00:00
Boone Gorges
e415270afb Tests: Correct 'meta_query' syntax in test related to WP_User_Query 'who' param.
The test, introduced in [32207], used the incorrect syntax for 'meta_query' -
one fewer level of array-nesting than what `WP_Meta_Query` requires. This
slip uncovered a bug introduced into `WP_User_Query` in [30094], whereby
an incorrectly formatted 'meta_query' parameter would be properly parsed by
`WP_User_Query` when passed alongside `who=authors`.

We need to fix the inconsistent syntax in order to resolve #36724.

See #36724, #32019, #23849, #27026.

git-svn-id: https://develop.svn.wordpress.org/trunk@37359 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-04 18:48:08 +00:00
Boone Gorges
8e417dd09b Tests: Introduce reset_phpmailer_instance() function.
This function provides a more convenient method for resetting the
PHPMailer instance than the previous technique of reaching into the global.

Props welcher.
Fixes #36658.

git-svn-id: https://develop.svn.wordpress.org/trunk@37358 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-04 03:48:46 +00:00
Boone Gorges
23b3f3e2ee Add tests for is_serialized_string().
Props borgesbruno.
Fixes #35952.

git-svn-id: https://develop.svn.wordpress.org/trunk@37357 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-04 03:29:47 +00:00
Weston Ruter
0321612c4d Customize: Handle filtering sidebars_widgets when the underlying option is non-existent.
Fixes warning related to a non-array argument for `array_merge()` in `WP_Customize_Widgets::customize_register()`. 

See [37166].
See #36389.
Fixes #36660.


git-svn-id: https://develop.svn.wordpress.org/trunk@37352 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 23:41:18 +00:00
Weston Ruter
018f988654 Customize: Pass WP_Customize_Setting instance as second argument to customize_value_{$id_base} filter.
Adds parity with setting instance being passed as second argument to `customize_sanitize_{$id}` and `customize_sanitize_js_{$id}`. Allows the actual ID of the (multidimensional) setting value being filtered to be inspected.

Props celloexpressions, westonruter.
Fixes #36452.


git-svn-id: https://develop.svn.wordpress.org/trunk@37350 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 22:41:36 +00:00
Drew Jaynes
0f468dd456 Comments: Adjust comment_author_email_link() and get_comment_author_email_link() to each accept a new optional fourth parameter, $comment, which enables overriding the $comment global.
Adds tests.

Props flixos90, boonebgorges, DrewAPicture.
See #36571.


git-svn-id: https://develop.svn.wordpress.org/trunk@37348 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 19:58:23 +00:00
Eric Andrew Lewis
32ed4fadf2 Posts: Allow get_page_uri() to be called without a $page argument.
`get_page_uri()` can now be called without an argument, which will return the page URI for the current post in the loop.

Props pollett.
Fixes #26284.


git-svn-id: https://develop.svn.wordpress.org/trunk@37345 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 18:28:04 +00:00
Drew Jaynes
0efe87a4fb Tests: Remove debug cruft left over from [34816].
See #17078.


git-svn-id: https://develop.svn.wordpress.org/trunk@37344 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 16:23:47 +00:00
Weston Ruter
f660ffb601 Widgets: Provide PHP 5.2 fallback for spl_object_hash() if disabled in logic for registering and unregistering pre-instantiated widgets.
Fixes #28216.


git-svn-id: https://develop.svn.wordpress.org/trunk@37333 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-30 22:35:27 +00:00
Dominik Schilling (ocean90)
d62141c38d Plugins: In plugin_basename() normalize the file path before unresolving symlinks.
`$wp_plugin_paths` contains normalized paths, see `wp_register_plugin_realpath()`.

Props jdgrimes, voldemortensen, flyingdr, ocean90.
Fixes #29154.

git-svn-id: https://develop.svn.wordpress.org/trunk@37332 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-30 15:08:06 +00:00
Weston Ruter
7ad11aaad8 Widgets: Allow WP_Widget subclass instances (objects) to be registered/unregistered in addition to WP_Widget subclass names (strings).
Allows widgets to be registered which rely on dependency injection. Also will allow for new widget types to be created dynamically (e.g. a Recent Posts widget for each registered post type).

See #35990.
Props mdwheele, PeterRKnight, westonruter.
Fixes #28216.


git-svn-id: https://develop.svn.wordpress.org/trunk@37329 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 18:48:27 +00:00
Scott Taylor
ec0614cf17 Media/Unit Tests: ensure that image sizes are indeed removed when errors are raised before assertions in Tests_Media.
See #36588.


git-svn-id: https://develop.svn.wordpress.org/trunk@37328 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 17:51:54 +00:00
Scott Taylor
fe85e78329 Media/Unit Tests: ensure that the GD absrtraction is used for GD unit tests for Images. Some of the procedural GD API functions can still throw ImagickException, which is fun.
See #36588.


git-svn-id: https://develop.svn.wordpress.org/trunk@37327 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 16:15:37 +00:00
Boone Gorges
00c39a3f98 Query: Discard non-scalar 'm' instead of attempting to sanitize.
`WP_Query` discards most non-array date values ('year', 'monthnum', etc) by
casting to integer. Since [25138], the 'm' parameter has been handled
as a string; see #24884. However, the string-handling introduced in [25138]
blindly attempted to handle arrays and other non-scalar types as strings,
resulting in PHP notices and invalid MySQL syntax.

Props vortfu.
Fixes #36718.

git-svn-id: https://develop.svn.wordpress.org/trunk@37324 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 13:14:18 +00:00
Eric Andrew Lewis
878343d4d1 Database: Set MySQL connection collation.
Fixes #36649.


git-svn-id: https://develop.svn.wordpress.org/trunk@37320 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-28 01:38:31 +00:00
Eric Andrew Lewis
8692cdbecd Build/Test Tools: Document WP_UnitTestCase->go_to()
Fixes #36679.


git-svn-id: https://develop.svn.wordpress.org/trunk@37319 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 18:24:34 +00:00
Jeremy Felt
967eb06e1b Tests: Reduce unnecessary count in create_many() in multisite user tests
The tests for `is_blog_user()` and `is_user_member_of_blog()` should be refactored. Until then, we can shave several seconds from the test time by avoiding unnecessary loops of the same tests.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37318 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 06:32:47 +00:00
Jeremy Felt
534f0e92a0 Users: Provide a full user object when checking for a spammy multisite user
`is_user_spammy()` falls back to the current user if one is not provided. There is no current user during authentication, so the result is always `false`. Pass a user to fill the void.

Adds tests for `wp_authenticate_spam_check()`.

Props websupporter.
Fixes #36546.


git-svn-id: https://develop.svn.wordpress.org/trunk@37316 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 05:35:37 +00:00
Rachel Baker
1bee2ff07a Post Thumbnails: Fix logic bug and tests from [37308] where post-thumbnails support wasn’t added if there were no previous post_types with support already.
See #22080

git-svn-id: https://develop.svn.wordpress.org/trunk@37313 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 20:28:46 +00:00
Rachel Baker
3518df091f Tests: Fix typo current_theme_support() -> current_theme_supports() from [37308]
git-svn-id: https://develop.svn.wordpress.org/trunk@37309 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 17:30:19 +00:00
Rachel Baker
2ff19ab7d3 Post Thumbnails: When using add_theme_support( ‘post-thumbnails’, array( $post_types) ) merge the supported post_types.
Allow the adding of post-thumbnail support for one or more post_types without unsetting any previously added post_types. This matches the behavior of other uses of `add_theme_support()` and the expectations of a function with a prefix of “add”.
To unset post-thumbnail support use `remove_theme_support()` instead.

Fixes #22080

Props alexkingorg, jmichaelward, and flixos90.

git-svn-id: https://develop.svn.wordpress.org/trunk@37308 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 17:04:25 +00:00
Sergey Biryukov
274902b03a Build/Test Tools: Reset the PHPMailer mock in Tests_Mail::tearDown().
Props welcher.
Fixes #36609.

git-svn-id: https://develop.svn.wordpress.org/trunk@37307 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-23 08:15:11 +00:00
Scott Taylor
aba30dc390 Unit Tests: prevent rewrite spillage from @group author unit tests.
See #36587.


git-svn-id: https://develop.svn.wordpress.org/trunk@37306 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 23:47:27 +00:00
Scott Taylor
a776b0b6df Comments: add a $comment parameter to get_comment_author_url_link().
Add unit tests (none exist).

Props flixos90, wonderboymusic.
Fixes #36573.


git-svn-id: https://develop.svn.wordpress.org/trunk@37305 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 22:44:33 +00:00
Jeremy Felt
5af20a3de3 Tests: Account for flexible IDs in main network deletion test
After [37299], the network IDs encountered by this test may be larger than "100".

This adjusts the test to respond accordingly until we have a better way to delete networks.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37300 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 15:21:14 +00:00
Boone Gorges
7c79386135 Tests: Use the same incrementor for all fields belonging to a given text fixture.
[35244] changed the way that `WP_UnitTest_Generator_Sequence()` created an
incrementor for object fields (like 'post_name' and 'user_email'), by making
incrementor static across the entire run of the test suite. While this helped
to enforce uniqueness across the tests, it has the side effect of bumping the
incrementor between fields on the same object (so that, eg, the same post might
have `post_name` "post-12" but `post_title` "Post 13". By switching to a
technique that uses the same incrementor for each field belonging to a given
fixture, we conform better to the expectations of developers using
`WP_UnitTest_Factory`.

Fixes #35199.

git-svn-id: https://develop.svn.wordpress.org/trunk@37299 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 14:35:52 +00:00
Gary Pendergast
f9e1cf5de0 Smilies: Move convert_smilies to happen later in the the_content filter.
In particular, we want it to occur after shortcode handling. The smiley conversion routine doesn't have any concept of shortcode structure, so may inadvertantly replace a smiley with HTML inside a shortcode attribute, which will cause the shortcode to not be parsed correctly.

Props Unyson for the initial suggested fix.

Fixes #36306. 



git-svn-id: https://develop.svn.wordpress.org/trunk@37298 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 07:07:03 +00:00
Gary Pendergast
74e88010c0 Emoji: The :roll: smiley is now an emoji.
Unicode 8 added `U+1F644`, "Face with Rolling Eyes", which matches our `:roll:` smiley. Continuing our ever present quest to rid the world of legacy smilies, we now translate that smiley into its emoji form.

Sadly, `:mrgreen:` remains sorely under-represented in the Unicode standard, I'm inclined to think that we should buy a voting membership of the Unicode Consortium, in order to rectify that situation. (Personally, I'm hoping for a green skin tone modifier.)

Fixes #36365.
 



git-svn-id: https://develop.svn.wordpress.org/trunk@37296 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 06:28:51 +00:00
Dominik Schilling (ocean90)
153610292d Media: Remove an extra quote when sending a link of a media file to the editor.
Introduced in [37035].

Props joemcgill, swissspidy, boonebgorges.
Fixes #36578.

git-svn-id: https://develop.svn.wordpress.org/trunk@37288 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 21:20:26 +00:00
Boone Gorges
ce350d5d5d Tests: More explicit fixture content when testing s=0 query string.
After [36647], the unit test generator sequence can put a 0 into the
'post_excerpt' field of a post fixture, causing false positives.

See [36520] for a parallel fix involving 'post_content'.

Fixes #36622.

git-svn-id: https://develop.svn.wordpress.org/trunk@37280 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 15:52:33 +00:00
Sergey Biryukov
d5e795ca9e Users: Add a unit test for [37276].
See #36009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37277 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 11:51:59 +00:00
Drew Jaynes
6c4c867b89 Tests: Pre-declare the $year_url property before initialization in Tests_Get_Archives::setUp().
Props pbearne.
Fixes #36611.


git-svn-id: https://develop.svn.wordpress.org/trunk@37271 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 02:55:52 +00:00
Jeremy Felt
67e6dc1c43 Tests: Add speedTrapListener to multisite's PHPUnit config
See #36566, #30017.


git-svn-id: https://develop.svn.wordpress.org/trunk@37267 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 17:01:07 +00:00
Jeremy Felt
f692459926 Tests: Allow override of MULTISITE and SUBDOMAIN_INSTALL constants
Props rmccue.
Fixes #36567.


git-svn-id: https://develop.svn.wordpress.org/trunk@37266 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 16:51:58 +00:00
Boone Gorges
01ef43ace7 Tests: After [37260], use WP's setUpBeforeClass() wrappers.
This ensures no leakage between tests of fixture IDs.

See #36602.

git-svn-id: https://develop.svn.wordpress.org/trunk@37261 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 15:30:40 +00:00
Boone Gorges
ddd88a79b1 Add tests for permastruct containing /%category%/.
See #36602.

git-svn-id: https://develop.svn.wordpress.org/trunk@37260 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 14:59:02 +00:00
Dominik Schilling (ocean90)
4bd7394a2e Themes: Revert [36112]
Adding the `singular` class per default to the list of body classes is breaking the layout of Twenty Eleven and other themes. Twenty Eleven adds the `.singular` class only to single pages if the page doesn't use specific page templates.

Props flixos90, swissspidy.
Fixes #36510.

git-svn-id: https://develop.svn.wordpress.org/trunk@37249 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-19 21:23:20 +00:00
Jeremy Felt
d72c2197ed Tests: Add test for multiple site path segments in bootstrap
This fixes a `@todo` that has been around since the introduction of these tests in [28910].

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37241 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:38:11 +00:00
Jeremy Felt
fa92abf4f3 Tests: Add missing params to doc blocks
* These should have been included in [37236] and [37238].
* Simplifies parameter names in `test_get_network_by_path()`

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37239 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:26:48 +00:00
Jeremy Felt
bf5abfd9d0 Tests: Use a data provider to test multisite's bootstrap
This also helps to get things in order before the introduction of a more testable multisite bootstrap function in #34941.

A `@todo` has been temporarily removed, to be re-introduced as a working test.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37238 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:18:51 +00:00
Jeremy Felt
5e2f936c28 Tests: Use a data provider in get_site_by_path() tests
See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37237 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 02:38:49 +00:00
Jeremy Felt
48ba391b9b Tests: Use a data provider to test get_network_by_path()
See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37236 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 02:00:36 +00:00
Jeremy Felt
e4efe5fac9 Tests: Share test fixtures in multisite bootstrap tests
* Remove unnecessary `setUp` and `tearDown` methods.
* Create networks and sites in `wpSetupBeforeClass` to share throughout.
* Destroy networks and sites in `wpTearDownAfterClass` to unpollute.

See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37234 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 01:37:47 +00:00
Jeremy Felt
89877c5941 Tests: Improve get_blog_count() tests
* Use `wp_update_network_counts()` to update the database with the most current data before testing.
* Use `wp_update_network_counts()` to update the database with the most current data after deleting the sites created during the test.
* Create only 1 extra site in each test rather than 4. This shaves several seconds off the test time.
* Stop testing for an extra count now that we update the network counts properly. Previously we looked at `$site_count_start + 9` rather than 8. Now this is `+ 1`, which aligns with the actual number of sites created.
* Test 3 explicit conditions - default, filter applied as `true`, and filter applied as `false`.
* Reset data before testing assertion to avoid a suspended state.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37233 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 01:28:56 +00:00
Boone Gorges
8ee26e699f Query: Allow results to be ordered by post_parent__in.
Props postpostmodern.
Fixes #36515.

git-svn-id: https://develop.svn.wordpress.org/trunk@37225 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-17 03:16:36 +00:00
Boone Gorges
d73ec171c0 Tests: Improvements to /post/query test class.
* Add `@group` annotation.
* Remove unnecessary `setUp()` method.

git-svn-id: https://develop.svn.wordpress.org/trunk@37224 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-17 03:12:39 +00:00
Jeremy Felt
426f5256fb Options: Do not set network options to autoload in single site
When multisite is not configured, the `_site_transient()` and `_site_option()` functions fallback to `_option()` and store network "meta/options" in `wp_options`.

Previously, those calls to `_option()` did not explicitly set the `autoload` parameter and anything assigned as a transient or option at the network level would be set to `autoload` by default, even though autoload is not yet a concept at the network option level.

This changes that behavior and forces the `autoload` setting to `no`. If `autoload` is desired, the single site option functions should be used.

Props thomaswm.
Fixes #22846.


git-svn-id: https://develop.svn.wordpress.org/trunk@37223 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-16 19:47:14 +00:00
Jeremy Felt
83d80f7329 Tests: Run network option tests as single and multisite
The `_network_option()` functions are available to all and
internally use `_option()` functions as a fallback. We should
be testing for that scenario as well.

Fixes #36552.


git-svn-id: https://develop.svn.wordpress.org/trunk@37222 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-16 19:21:49 +00:00
Jeremy Felt
a56fc1fba0 Multisite: Introduce WP_Theme methods to network enable/disable themes.
* `WP_Theme::network_enable_theme()` can be used to enable a theme or array of themes on a network.
* `WP_Theme::network_disable_theme()` can be used to disable a theme or array of themes on a network.
* Use these new methods in the network admin vs direct `update_site_option()` calls.
* Add tests.

Props igmoweb.
Fixes #30594.


git-svn-id: https://develop.svn.wordpress.org/trunk@37202 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-14 03:39:45 +00:00
Sergey Biryukov
c39ba1cdd9 Docs: Reference the correct variable in WP_Ajax_UnitTestCase::_handleAjax() documentation.
Props meitar.
Fixes #36522.

git-svn-id: https://develop.svn.wordpress.org/trunk@37199 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-14 02:28:03 +00:00
Boone Gorges
26a5e78d94 Improve testability and coverage of wp_ext2type().
* Following pattern of `wp_get_mime_types()`, introduce `wp_get_ext_types()` function. New function returns a filtered list of file types with their extensions.
* Use this function in new tests for `wp_ext2type()`.

Props borgesbruno.
Fixes #35987.

git-svn-id: https://develop.svn.wordpress.org/trunk@37189 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-13 03:11:25 +00:00
Boone Gorges
765e23a4a6 Use LEFT JOIN when building WP_Tax_Query SQL.
`LEFT JOIN` ensures that `NOT EXISTS` queries will not miss posts that have
no taxonomy data whatsoever.

Props swissspidy, crstauf.
Fixes #36343.

git-svn-id: https://develop.svn.wordpress.org/trunk@37184 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-12 20:36:31 +00:00
Jeremy Felt
f98744ec86 Ensure consistent dependency order when using wp_add_inline_script()
This disables the concatenation of remaining enqueued scripts once `wp_add_inline_script()` is invoked, which allows us to reliably print these scripts and their before/after inline scripts in the desired order.

Props gitlost, azaozz, swisspidy, ocean90.
Fixes #36392.


git-svn-id: https://develop.svn.wordpress.org/trunk@37171 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-10 03:32:47 +00:00
Dominik Schilling (ocean90)
ca5db69c31 Customize: Harden assignment of Customizer settings transports for selective refreshable widgets
Theme support for `customize-selective-refresh-widgets` can be added _after_ the logic for registering the settings for incoming widgets that have been changed. This is due to themes adding the theme support in `after_setup_theme` which is also the action where `WP_Customize_Widgets::register_settings()` is called. If these both happen at priority 10, which one is called first depends on which one was added first. The other issue is that at the time that `WP_Customize_Widgets::register_settings()` is called at `after_setup_theme`, it is called before `widgets_init` and thus no widgets are yet registered. This means that any settings registered at this point will always have a `refresh` transport even if the theme supports `customize-selective-refresh-widgets`, since the `WP_Widget` instance is not visible yet to see if it supports selective refresh.

The fix: Defer `WP_Customize_Widgets::register_settings()` from `after_setup_theme` to `widgets_init` at priority 95 when the widget objects have all been registered. Also, ensure that the preview filter for `sidebars_widgets` is added before the sidebars are iterated for adding the controls.

Props westonruter.
Fixes #36389.

git-svn-id: https://develop.svn.wordpress.org/trunk@37166 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-07 20:58:56 +00:00
boonebgorges
f1c3ec9010 Use __trashed suffix rather than -%trashed% for trashed post slugs.
Percent signs are reserved characters in URIs. As such, it was impossible for
plugins to route requests to trashed posts, as happens in bbPress. The new
`__trashed` suffix should be sufficiently unique.

Also adds a test that demonstrates that the `__trashed` suffix can be
appended to slugs that contain the suffix somewhere other than the end of
the string.

Props netweb, ericlewis.
Fixes #11863.

git-svn-id: https://develop.svn.wordpress.org/trunk@37165 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-07 19:21:02 +00:00
Mark Jaquith
9deec9e723 REST API: Deliver parameters unadulterated instead of slashed.
We goofed, and parameters accessed through the REST API's methods
were slashed (inconsistently, even). This unslashes the data, so
you get the un-messed-with data that was sent.

Props joehoyle.
Fixes #36419.

git-svn-id: https://develop.svn.wordpress.org/trunk@37163 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-06 21:01:11 +00:00
John Blackbourn
6c79b715bd Role/Capability: Add create_sites and delete_sites to the list of capabilities that are checked as part of the comporehensive roles and capabilities tests.
See #32394, #36413


git-svn-id: https://develop.svn.wordpress.org/trunk@37157 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-04 22:29:55 +00:00
Aaron Jorbin
253308253b Adjust unit tests to account for change in [37144]
git-svn-id: https://develop.svn.wordpress.org/trunk@37150 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-30 19:52:14 +00:00
Konstantin Obenland
ef53a0db39 Template: Remove $size reference from get_custom_logo().
Argument was removed in [37077] in favor of `with` and `height` arguments.

Props ocean90.
Fixes #36327.



git-svn-id: https://develop.svn.wordpress.org/trunk@37135 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-30 17:19:41 +00:00
Ella Iseulde Van Dorpe
859d40bd24 Editor: wptextpattern: add back inline tests
See [37024].
See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@37080 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-25 13:30:10 +00:00
Sergey Biryukov
0058968499 Canonical / Query: Restore the is_404() check in wp_old_slug_redirect() which was removed in [34659].
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x.

Remove the unit tests which are no longer supported.
This also removes the `is_feed()` code to avoid confusion - only pages & embeds will be redirected.

Merges [36280] and [36281] to trunk.

Props dd32.
See #21602, #35344.

git-svn-id: https://develop.svn.wordpress.org/trunk@37075 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-23 21:53:44 +00:00
Boone Gorges
8e317daa37 Tests: Ensure that the default wp_die() handler can handle a WP_Error object.
Props dd32, utkarshpatel.
Fixes #36166.

git-svn-id: https://develop.svn.wordpress.org/trunk@37071 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-23 19:00:38 +00:00
Dominik Schilling (ocean90)
6c0a66cf49 Users: In edit_user() check for a blank password when adding a user.
Props wesleye, gitlost, adamsilverstein.
Fixes #35715.

git-svn-id: https://develop.svn.wordpress.org/trunk@37059 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-22 23:06:29 +00:00
Rachel Baker
dab5c5daa7 XMLRPC: Unit tests left off [r37043]
See #35874.

Props redsweater, rachelbaker

git-svn-id: https://develop.svn.wordpress.org/trunk@37044 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-22 15:11:06 +00:00
Weston Ruter
4569f93d3e Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.


git-svn-id: https://develop.svn.wordpress.org/trunk@37040 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-21 21:58:02 +00:00
Andrew Ozz
058a2f558d Media: fix erroneously inserting a rel attribute in get_image_send_to_editor(). Reverts most of [34259] and [34260] and adds a unit test.
Props joemcgill, azaozz.
Fixes #36084.

git-svn-id: https://develop.svn.wordpress.org/trunk@37035 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-18 20:04:19 +00:00
Andrew Ozz
33947e4ba6 Responsive Images: the src of the image has to be first in the srcset, because of a bug in iOS8. Update the unit tests to reflect the changes.
Props jaspermdegroot, joemcgill, azaozz.
Fixes #35030.

git-svn-id: https://develop.svn.wordpress.org/trunk@37034 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-18 19:44:50 +00:00
Rachel Baker
da45e59bbd REST API: Add home_url to API index to avoid confusion with site_url.
Confusion abound, the API index is the generic term `url` to display the `site_url`. New `home` key will display the `home_url` in the index as well.

Fixes #35647.

git-svn-id: https://develop.svn.wordpress.org/trunk@37031 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-17 19:15:57 +00:00
Sergey Biryukov
57646fb7ba TinyMCE: Adjust textpattern tests for the changes in [37023].
See #33300.

git-svn-id: https://develop.svn.wordpress.org/trunk@37024 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-17 00:46:26 +00:00
John Blackbourn
f1af2813d3 Media: When generating the base URL to be used in the srcset attribute, use an https scheme when the image base URL's host matches that of the current host, and the request is being served over HTTPS. This prevents mixed content warnings caused by http embedded media.
See #34945
Props joemcgill


git-svn-id: https://develop.svn.wordpress.org/trunk@37022 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 22:48:13 +00:00
Dominik Schilling (ocean90)
ab8ff0dee1 Responsive images: Skip images with a missing $image_meta['file'] value.
Props joemcgill.
See [37002].
Fixes #35480.

git-svn-id: https://develop.svn.wordpress.org/trunk@37018 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 17:47:41 +00:00
Andrew Ozz
1046806376 Responsive images: do not attempt to create srcset when the image meta is missing or corrupted.
Props overclokk, jaspermdegroot, joemcgill.
Fixes #35480.

git-svn-id: https://develop.svn.wordpress.org/trunk@37002 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 02:17:19 +00:00
Andrew Ozz
22e01b6274 TinyMCE: update to 4.3.8, changelog: https://www.tinymce.com/docs/changelog/#version438-march152016.
Fixes #36254.

git-svn-id: https://develop.svn.wordpress.org/trunk@37000 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 21:37:22 +00:00
Mike Schroder
eb0268dbe7 Media: Fix typo in test_image_preserves_alpha_on_rotate().
peserves -> preserves; introduced in [31040].

See #30596.

git-svn-id: https://develop.svn.wordpress.org/trunk@36998 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 03:50:40 +00:00
Gary Pendergast
8233227667 WPDB: Reset connection status variables when the connection is closed.
Fixes #36240.



git-svn-id: https://develop.svn.wordpress.org/trunk@36997 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 03:27:14 +00:00
Boone Gorges
9f05bf8ed9 Query: Ignore search terms consisting of a single dash.
Due to the "exclude" support added in WP 4.4, single dashes were being
converted to "NOT LIKE '%%'" clauses, causing all searches to fail.

Props RomSocial, swissspidy.
Fixes #36195.

git-svn-id: https://develop.svn.wordpress.org/trunk@36989 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 14:11:16 +00:00
Boone Gorges
0fdf0d4566 Improve error handling in get_categories().
When passed an invalid `'taxonomy'`, `get_terms()` will return a `WP_Error`
object. This object should not be blindly cast to an array. Instead, an empty
array should be returned, to indicate that no matching terms have been found.

Props virgodesign, sebastian.pisula.
Fixes #36227.

git-svn-id: https://develop.svn.wordpress.org/trunk@36988 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 13:52:14 +00:00
Boone Gorges
8b564b6106 Fix test related to cap check in get_edit_term_link().
The test was introduced in [36646] was intended to demonstrate that the cap
check in `get_edit_term_link()` uses the custom capability from the correct
taxonomy when `$taxonomy` is not specified but must be inferred from the
provided term. However, the test was wrongly written in pretty much every way.
Antiprops boonebgorges.

Props swissspidy.
See #35922.

git-svn-id: https://develop.svn.wordpress.org/trunk@36986 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 01:51:12 +00:00
John Blackbourn
93942d330e Correct a unit test for custom icon functionality.
See #36086


git-svn-id: https://develop.svn.wordpress.org/trunk@36952 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 19:58:49 +00:00
Konstantin Obenland
cda0901425 Template: Explicitly set full as the default custom logo size.
See #33755.


git-svn-id: https://develop.svn.wordpress.org/trunk@36950 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 19:02:25 +00:00
Konstantin Obenland
6f69ca857e Tests: Introduce multisite unit tests.
Makes sure custom logo functions work for other sites within a network.
Fixes a bug in `get_custom_logo()` where the correct logo was returned, but
linked to the wrong site.

H/t ocean90.
See #33755, #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36949 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 18:56:56 +00:00
Konstantin Obenland
6d951b3c5d Customize: Only add custom logo’s header text control if needed.
Dissolves `WP_CustomLogo` and adopts a structure similar to custom header and background (See `_delete_attachment_theme_mod()`).
The option to hide header text only gets added if it’s not already part of custom header, and only if selectors have been registered when theme support for custom logos was declared. Themes can add `postMessage` support for it as well.

Example:
{{{
add_theme_support( 'custom-logo', array(
    'size' => ‘large’,
    'header-text' => array( 'site-title', 'site-description' ),
) );
}}}

See #33755.


git-svn-id: https://develop.svn.wordpress.org/trunk@36915 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 23:43:49 +00:00
Konstantin Obenland
4286a3e63b Tests: Let's not reinvent wp_get_attachment_image().
See https://travis-ci.org/aaronjorbin/develop.wordpress/builds/114913862
See #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36914 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 23:27:28 +00:00
Konstantin Obenland
bf852575e2 Tests: Account for expected attachemnt size in custom logo output.
Fixes #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36911 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 21:56:57 +00:00
Aaron Jorbin
6adbde9340 Add Automated Tests for custom logo support
[36698] introduced custom logos, this tests the API. 

Fixes #36086. See #33755.
Props obenland.



git-svn-id: https://develop.svn.wordpress.org/trunk@36905 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 20:43:28 +00:00
Weston Ruter
dcbbeffc57 Customize: Fix regressions and harden implementation of selective refresh for nav menus.
* Request full refresh if there are nav menu instances that lack partials for a changed setting.
* Restore `WP_Customize_Nav_Menus::$preview_nav_menu_instance_args` and `WP_Customize_Nav_Menus::export_preview_data()` from 4.3, and keeping a tally of all `wp_nav_menu()` calls regardless of whether they can use selective refresh.
* Ensure that all instances of `wp_nav_menu()` are tallied, regardless of whether they are made during the initial preview call or during subsequent partial renderings. Export `nav_menu_instance_args` with each partial rendering response just as they are returned when rendering the preview as a whole.
* Fix issues with Custom Menu widget where nav menu items would fail to render when switching between menus when a menu lacked items to begin with.
* Make sure the fallback behavior is invoked when the partial is no longer associated with a menu.
* Do fallback behavior to refresh preview when all menu items are removed from a menu.

Follows [36586].
See #27355.
Fixes #35362.


git-svn-id: https://develop.svn.wordpress.org/trunk@36889 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 00:08:51 +00:00
Drew Jaynes
f07f2252fe Menus: Avoid a notice when outputting a description for an existing archive menu item for a post type that doesn't.
Props bradyvercher.
See [36859]. Fixes #35324.


git-svn-id: https://develop.svn.wordpress.org/trunk@36888 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 18:24:50 +00:00
Dominik Schilling (ocean90)
5064747619 Tests: Remove test_new_files_are_not_in_old_files_array() from [36843].
The test assumes that if a CSS file was added to `$_old_files` all three files (.css, .min.css, -rtl.min.css; it's actually missing the fourth case, -rtl.css) don't exist anymore. But this isn't always the case. The test is also incredible slow because it does three `file_exists()` checks for each file — the global contains 646 files currently.

It's important what we have in the /build directory and that's covered by `test_new_files_are_not_in_old_files_array_compiled()`.

Fixes #36083.

git-svn-id: https://develop.svn.wordpress.org/trunk@36885 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 16:44:25 +00:00
Dion Hulse
11082eea97 Tests: Remove debug from [36882].
git-svn-id: https://develop.svn.wordpress.org/trunk@36883 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 07:07:56 +00:00
Dion Hulse
adcb0b5a4a Tests: Merge the two different wp_normalize_path() tests.
See #35996, [36881].


git-svn-id: https://develop.svn.wordpress.org/trunk@36882 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 07:06:12 +00:00
Dion Hulse
8d9b0a9d22 Filesystem: Support Windows shares/DFS roots in wp_normalize_path().
Props rilwis for initial patch.
Fixes #35996.


git-svn-id: https://develop.svn.wordpress.org/trunk@36881 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-08 05:59:45 +00:00
Pascal Birchler
3a51ff4d2e Taxonomy: Improve backward compatibility on the wp-admin/term.php page.
Specifically, run `do_action( 'edit-tags.php' );` on this new term edit page introduced in [36308]. Changes the GET param back to `tag_ID` and properly sets the screen base in `WP_Screen`.

See #34988.

git-svn-id: https://develop.svn.wordpress.org/trunk@36874 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-07 12:55:04 +00:00
Pascal Birchler
afdf1c9ec1 Embeds: Adjust the iframe title attribute for improved accessibility.
Changes the title attribute from `Embedded WordPress Post` to `"Post name" — site title`.

Props ramiy.
Fixes #35804.

git-svn-id: https://develop.svn.wordpress.org/trunk@36873 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-07 09:59:02 +00:00
Dominik Schilling (ocean90)
00e87b40c8 Dependencies: Improve group processing of script dependencies.
This is a follow-up to [36604].

When processing dependencies `$this->group` will be the minimum of the script's registered group and all preceding siblings. This is wrong because only a scripts ancestors in the dependency chain should affect where it is loaded. Effectively `$this->group` introduced a form of global state which potentially corrupted the group of dependencies. Sorting covers up this problem.
The issue in #35873 was that script were not moving their dependencies to a lower group when necessary.

The fix:
* In `WP_Dependencies::all_deps()` pass the new `$group` value to `WP_Dependencies::all_deps()`. Previously the wrong value was passed because the parent script could have moved with `WP_Scripts::set_group()`.
* In `WP_Scripts::all_deps()` pass the `$group` parameter to `WP_Dependencies::all_deps()` so it doesn't always use `false` for `$group`. Same for `WP_Styles::all_deps()`.

Props stephenharris, gitlost.
Fixes #35956.

git-svn-id: https://develop.svn.wordpress.org/trunk@36871 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-06 19:49:54 +00:00
Aaron Jorbin
4af0645ae8 Ensure Description is respected in post type archive menu items.
Tested scenarios include: using the default (which is the post type description), Setting a custom description for that individual menu item, and setting a custom description that is blank. Introduced in r35382.

Props Toro_Unit, mayukojpn, extendwings, jorbin.
Fixes #35324. See #16075.



git-svn-id: https://develop.svn.wordpress.org/trunk@36859 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 22:56:31 +00:00
Aaron Jorbin
57d8c6668a Fix License test
Broken in r36855

Fixes #35278



git-svn-id: https://develop.svn.wordpress.org/trunk@36856 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 20:21:23 +00:00
ericlewis
59c8ba7871 Build/Test Tools: Document PHP unit test classes.
Props boonebgorges.
Fixes #35494.


git-svn-id: https://develop.svn.wordpress.org/trunk@36854 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 19:47:41 +00:00
John Blackbourn
48959ec76e Posts, Post Types: Ensure that non-ASCII characters in attachment slugs aren't shown in urlencoded form in the sample permalink UI.
Fixes #35980


git-svn-id: https://develop.svn.wordpress.org/trunk@36853 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 03:55:33 +00:00
Sergey Biryukov
fb7ada9e9a Comment out some CSS files in $_old_files that were added back as a result of [36341].
Add a unit test to make sure the `$_old_files` array does not contain any current project files.

Props joemcgill, swissspidy.
Fixes #36083.

git-svn-id: https://develop.svn.wordpress.org/trunk@36843 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-04 07:55:21 +00:00
Sergey Biryukov
95f12701fb Date/Time: Add a unit test for mysql_to_rfc3339().
Props borgesbruno.
Fixes #36054.

git-svn-id: https://develop.svn.wordpress.org/trunk@36832 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 13:16:31 +00:00
Joe Hoyle
fc0ed5e1ca REST API: Unit test for OPTIONS request should call rest_send_allow_header
In [36829] we moved this logic to rest_send_allow_header()

See #36829.


git-svn-id: https://develop.svn.wordpress.org/trunk@36831 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 11:37:48 +00:00
Joe Hoyle
b38ea44e9a OPTIONS requests to REST API should return Allow header.
An OPTIONS request was incorrectly returning an "Accept" header which
was a typo of "Allow". This meant Accept was showing "GET, POST" for example,
however it was also not running the permission checks on the endpoints.

Instead, the correct route needs to be set on the request object, which means
the normal handling for the Allow header will kick in. This technically
breaks backwards compatibility, however given the value of Accept was also wrong
then this should not be an issue.

Fixes #35975.


git-svn-id: https://develop.svn.wordpress.org/trunk@36829 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 09:54:32 +00:00
John Blackbourn
dfb666f7cf Uploads: Add tests for device upload capabilities based on user agent.
Fixes #35976
Props borgesbruno


git-svn-id: https://develop.svn.wordpress.org/trunk@36810 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-03 02:00:06 +00:00
Weston Ruter
0c3716670a Customize: Define params on WP_Customize_Partial::render_callback() for the sake of subclasses overriding this method.
Fixes a strict standards notice regarding the method signature needing to be compatible.

See #27355.


git-svn-id: https://develop.svn.wordpress.org/trunk@36801 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-02 06:08:38 +00:00
Andrew Ozz
b4db71a2f8 TinyMCE: update to 4.3.6. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #36035.

git-svn-id: https://develop.svn.wordpress.org/trunk@36798 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-01 23:12:43 +00:00
Pascal Birchler
4bad4cd246 Tests: Add unit tests for number_format_i18n().
Props pbearne for initial patch.
Fixes #36029.

git-svn-id: https://develop.svn.wordpress.org/trunk@36795 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-01 21:19:20 +00:00
Boone Gorges
c67a463427 Use markTestSkipped() to skip a multisite-only test.
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36791 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:55:56 +00:00
Boone Gorges
26a8cbdb44 Ensure that user __unset() tests make assertions.
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36790 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:49:15 +00:00
Boone Gorges
1fb24d9e8d Remove erroneous return in date_query test.
Introduced in [34989].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36789 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:40:20 +00:00
Boone Gorges
2b19ef7b76 mbstring.func_overload test should be skipped properly.
This avoids PHPUnit notices related to "risky" tests.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36788 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:37:42 +00:00
Boone Gorges
7e55710025 Remove tests related to wp_*_post_meta() functions.
These tests functions were introduced as part of the attempt to straighten out
metadata slashing. See [23416]. The functions were later pulled out [23554],
but the tests were not removed at the same time. Since that point, they've
done nothing, so they can safely be removed.

See #21767. See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36787 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:13:28 +00:00
Boone Gorges
0a1e0cd7d6 Tests: Make sure that test_wp_mail_break_it() makes an assertion.
Let's make what is possibly the oddest test in WordPress even a bit odder.

See https://core.trac.wordpress.org/ticket/28909#comment:47 for backstory on
the test.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36786 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 22:04:32 +00:00
Boone Gorges
7505593ab8 Tests: setExpectedDeprecated and setExpectedIncorrectUsage tests should make assertions.
Introduced in [31306].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36785 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:55:41 +00:00
Boone Gorges
603fee5749 More specific test for a bad callback in WP_Customize_Partial test.
The 'render_callback' passed to `WP_Customize_Partial` must either echo or
return a result - not both. When it's detected that the callback echoes and
returns a value, the return value takes precedence. This is now reflected in
the corresponding unit test.

Introduced in [36586].

See #27355. See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36784 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:53:18 +00:00
Boone Gorges
8b7fdc982f Remove test related to deprecated Customizer export_preview_data() method.
The method was gutted and deprecated in [36586], so there's no reason to keep
the test.

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36782 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 21:07:00 +00:00
Boone Gorges
070b8a6154 Put an assertion in test_nonexistent_array() test.
The point of the test is to demonstrate that PHP doesn't throw a notice when
calling `unset()` on an undefined array key. To placate PHPUnit's useless test
detection, we add a redundant assertion.

Introduced in [25240].

See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36779 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 20:34:48 +00:00
Boone Gorges
60b307b941 Make sure an assertion takes place in 'visited' test for get_category_parents().
See #36016.

git-svn-id: https://develop.svn.wordpress.org/trunk@36778 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 20:30:04 +00:00
Sergey Biryukov
13e409ac15 Formatting: In sanitize_title_with_dashes(), convert &nbsp, &ndash, and &mdash HTML entities to hyphens on save.
Props polevaultweb for initial patch.
Fixes #31790.

git-svn-id: https://develop.svn.wordpress.org/trunk@36775 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-29 04:41:03 +00:00
Drew Jaynes
92dbe29078 Posts: Add tests for the cascading fallback behavior of several 'public'-related arguments in register_post_type().
Covers the 'exclude_from_search', 'publicly_queryable', 'show_ui', 'show_in_menu', 'show_in_nav_menus', and 'show_in_admin_bar' arguments, all of which eventually inherit from 'public' if not set.

Fixes #35985.


git-svn-id: https://develop.svn.wordpress.org/trunk@36768 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 22:58:45 +00:00
Sergey Biryukov
4f91aae382 L10n: Add unit tests for _n_noop() and _nx_noop().
Props realloc.
Fixes #35961.

git-svn-id: https://develop.svn.wordpress.org/trunk@36766 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 20:48:58 +00:00
Sergey Biryukov
a18e7ae7c3 Ad a unit test for bool_from_yn().
Props borgesbruno.
Fixes #35972.

git-svn-id: https://develop.svn.wordpress.org/trunk@36764 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 19:55:48 +00:00
John Blackbourn
54adcce28d Rewrite Rules: Ensure url_to_postid() operates as expected when it's used in the context of another site within a Multisite network that uses mixed URL schemes.
Fixes #35531


git-svn-id: https://develop.svn.wordpress.org/trunk@36750 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 02:12:13 +00:00
John Blackbourn
717c1c4041 HTTP API: Add the missing 1xx HTTP response codes as constants of the WP_Http class, and add tests to ensure all available response codes are covered.
Fixes #36294


git-svn-id: https://develop.svn.wordpress.org/trunk@36749 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-28 01:45:24 +00:00
Boone Gorges
3d8cade8c8 Tests: Don't modify global state before checking whether to skip get_locale() tests.
Introduced in [36740].

Props ocean90.
See #35965.

git-svn-id: https://develop.svn.wordpress.org/trunk@36741 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 20:28:07 +00:00
Boone Gorges
da128bc5e3 Add tests for get_locale().
Props realloc.
Fixes #35965.

git-svn-id: https://develop.svn.wordpress.org/trunk@36740 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 20:21:11 +00:00
John Blackbourn
48aa555ced Refactor some janky URL tests into data providers for clarity and better error reporting.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36722 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 02:10:32 +00:00
John Blackbourn
1ebe4658f1 Remove (or at least reduce) the need to reset common $_SERVER variables before assertions or between tests, by introducing a method which automatically resets them during test setup.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36721 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 02:08:47 +00:00
Ella Iseulde Van Dorpe
37fda5a8b9 TinyMCE: textpattern: clean up
* Use editor.once instead of storing into variables.
* Add pattern for hr.

See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@36719 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:51:01 +00:00
Sergey Biryukov
918da6f8c2 L10n: Add test for get_available_languages().
Props realloc.
Fixes #35950.

git-svn-id: https://develop.svn.wordpress.org/trunk@36718 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:38:25 +00:00
John Blackbourn
701f639e30 Correct some more tests which were using example.org instead of WP_TESTS_DOMAIN.
See #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@36717 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-26 00:25:10 +00:00
John Blackbourn
6cf0caf13e Unify the initialisation of $_SERVER variables during test bootstrap. This abstracts the (re-)initialisation into a function that can be used inside of tests too, before assertions are performed.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36715 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:59:56 +00:00
John Blackbourn
fd03f6ec19 Canonical: Improve the method names and inline docs for canonical redirect tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@36714 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:55:57 +00:00
John Blackbourn
fd8e31e3b2 Move some assertions in HTTPS related tests, so failures that occur before the environment reset don't result in a contaminated test environment.
See #35954


git-svn-id: https://develop.svn.wordpress.org/trunk@36711 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 21:17:34 +00:00
Dominik Schilling (ocean90)
d30e49fa60 L10n: Add test for wp_get_pomo_file_data().
Props realloc.
See #35284.

git-svn-id: https://develop.svn.wordpress.org/trunk@36710 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 15:01:23 +00:00
Pascal Birchler
a57b5c8ce5 Embeds: Use a more accessible way to initially hide the iframe.
This fixes a bug in Firefox where assets inside the iframe aren't being displayed because they have no computed style.

See #35894.

git-svn-id: https://develop.svn.wordpress.org/trunk@36708 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-25 10:22:43 +00:00
Drew Jaynes
138b55c16e Embeds: Update embed template paths and messages in tests, missed in [36693].
Props ocean90
See #34561.


git-svn-id: https://develop.svn.wordpress.org/trunk@36694 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 21:20:41 +00:00
Boone Gorges
036bac45bc Improve 'offset' calculation when querying for hierarchical terms.
When querying for terms in hierarchical taxonomies, `get_terms()` initially
queries for all matching terms, and then trims the located results based on the
`$number` and `$offset` arguments passed to the function. See #8832. However,
a flaw in the original logic meant that results were failing to be trimmed
properly in cases where `$offset` exceeds the total number of matching terms;
in these cases, we should force an empty array.

Props danielbachhuber.
Fixes #35935.

git-svn-id: https://develop.svn.wordpress.org/trunk@36691 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 19:12:45 +00:00
Weston Ruter
d80ef26b48 Customize: Allow controls to be registered without any associated settings.
* Improves parity between partials and controls. A partial or control can be settingless if instantiated with `settings` param as empty array (otherwise, if null, then the partial/control ID is used). 
* Eliminate need to create dummy settings that serve no purpose except to place a control in the UI.
* Removes dummy settings for `create_new_menu` and `new_menu_name`.
* Introduces `WP_Customize_Control::$capability` and `WP_Customize_Partial::$capability`, and if set checks them in the respective `check_capabilities()` methods.
* Prevents PHP fatal error from happening when non-existing settings are provided to control: "Call to a member function `check_capabilities()` on a non-object".
* Fixes issue where nav menu items and widgets were no longer working with selective refresh because cap check was failing.

See #27355.
Fixes #35926.


git-svn-id: https://develop.svn.wordpress.org/trunk@36689 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 18:27:45 +00:00
Ryan McCue
b464a4ba3a REST API: Fix error in Request tests.
On the 21st of November, 2014, I committed tests for WP_REST_Request
to the API plugin. Although I didn't realise at the time, I was
causing my future self to go through hours of sufferring.

Unfortunately, I forgot to call parent::setUp() which would break
the tests in subtle ways in the future and would ruin the good part
of my day.

Let this be a warning to all of you who write future unit tests.

See f0396be17e
for the original commit.


git-svn-id: https://develop.svn.wordpress.org/trunk@36678 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 08:28:12 +00:00
Weston Ruter
407a2bd076 Customize: Introduce customize_nav_menu_searched_items filter for modifying results of nav menu item searches.
This new filter can be used in conjunction with the `customize_nav_menu_available_items` and `customize_nav_menu_available_item_types` filters.

Props TimothyBlynJacobs, westonruter.
Fixes #34947.


git-svn-id: https://develop.svn.wordpress.org/trunk@36676 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 05:56:40 +00:00
Ryan McCue
c3c445c0c9 REST API: Use WP_REST_Request::from_url() when embedding.
See #35803.


git-svn-id: https://develop.svn.wordpress.org/trunk@36674 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 04:19:44 +00:00
Ryan McCue
92d2be6a3d REST API: Add WP_REST_Request::from_url()
Allows converting a REST URL into a Request object.

Props danielbachhuber.
Fixes #35803.


git-svn-id: https://develop.svn.wordpress.org/trunk@36673 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 04:00:12 +00:00
Sergey Biryukov
45017abf02 Revisions: Clean up _wp_post_revision_fields():
* Move the array processing to a new function, `_wp_post_revision_data()`.
* Make both functions accept a post array or a `WP_Post` object. 
* Always apply the `_wp_post_revision_fields` filter and pass the post data to it.

Fixes #13382.

git-svn-id: https://develop.svn.wordpress.org/trunk@36659 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-24 00:43:31 +00:00
Pascal Birchler
9fb4d30ada Posts: Introduce get_post_types_by_support().
Similar to `get_post_types()`, this new function returns a list of post type names that support a specific feature.

Props wpsmith, barryceelen, swissspidy.
Fixes #34010.

git-svn-id: https://develop.svn.wordpress.org/trunk@36652 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 22:49:17 +00:00
Weston Ruter
fd46fad1c8 Customize: Fix and extend broken ajax unit tests to account for partials being skipped from rendering.
Fixes regression introduced in [36643].

See #35914.


git-svn-id: https://develop.svn.wordpress.org/trunk@36650 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 21:45:51 +00:00
Dominik Schilling (ocean90)
3a836ea224 Styles: Clarify the allowed values for the $media parameter of wp_register_style()/wp_enqueue_style().
Adds unit test.

Fixes #35921.

git-svn-id: https://develop.svn.wordpress.org/trunk@36649 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:40:43 +00:00
Boone Gorges
245e40f384 Query: Search should match post_excerpt in addition to title and content.
When ordering search results, exact matches in the post excerpt are weighted
above those in post content, but below those in the post title.

Props swissspidy, sebastian.pisula.
FIxes #35762.

git-svn-id: https://develop.svn.wordpress.org/trunk@36647 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:13:22 +00:00
Boone Gorges
193196a552 Make $taxonomy parameter optional in get_edit_term_link().
Props nicdford, sc0ttkclark.
Fixes #35922.

git-svn-id: https://develop.svn.wordpress.org/trunk@36646 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 20:06:25 +00:00
Weston Ruter
c9b47e9d92 Customize: Skip exporting partials to client and handling rendering requests if user can't modify associated settings.
Introduces `WP_Customize_Partial::check_capabilities()` for parity with `WP_Customize_Control::check_capabilities()`.
 
See #27355.
Fixes #35914.


git-svn-id: https://develop.svn.wordpress.org/trunk@36643 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 18:13:30 +00:00