Commit Graph

961 Commits

Author SHA1 Message Date
Scott Taylor 7dd8a1364a In the `youtube_embed_url` embed handler, make `embed` a non-capturing group that alternately matches for `v` - YouTube supports both URL paths.
Add unit test cases.

Props dmchale for some patch work.
Fixes #32161.


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


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

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


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

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



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

See #32444.


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

Props ramiy, voldemortensen.
Fixes #30082.

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

Props maxxsnake.
Fixes #32592.

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


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

Fixes #32590.

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

props akirk.
fixes #30438.

git-svn-id: https://develop.svn.wordpress.org/trunk@32708 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-08 13:28:44 +00:00
Ella Iseulde Van Dorpe 11de1cedaa TinyMCE: wptextpattern: make tests ~2x faster
* Reuse the same instance for all tests in the module.
* Run without CSS (skin).
* Less typing.

See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32706 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-07 22:15:47 +00:00
Ella Iseulde Van Dorpe 63183254c9 Customizer: hide controls on test page
Introduced in [30919].
See #32577 and #30701.


git-svn-id: https://develop.svn.wordpress.org/trunk@32701 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-07 09:03:03 +00:00
Ella Iseulde Van Dorpe b866b19a20 TinyMCE: wptextpattern: disable for IE 8 and lower
Props azaozz, iseulde.
See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32700 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-06 22:37:13 +00:00
Ella Iseulde Van Dorpe 5bac5f7ccd TinyMCE: add wptextpattern plugin
This plugin can automatically format text patterns as you type. It includes two patterns: unordered (`* ` and `- `) and ordered list (`1. ` and `1) `). If the transformation in unwanted, the user can undo the change by pressing backspace, using the undo shortcut, or the undo button in the toolbar.

This is the first TinyMCE plugin that has unit tests and there's some good groundwork for adding tests to existing plugins in the future.

First run. See #31441.


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

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

Props joehoyle, boonebgorges.
Fixes #32250.

git-svn-id: https://develop.svn.wordpress.org/trunk@32683 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-02 13:29:44 +00:00
Dominik Schilling (ocean90) 5ae2271098 Customizer: Improve JS templates for Panels and Sections added in [32658].
* Always fall back to using the default template if no custom template exists.
* Provide a set of default params when constructing new `Section` and `Panel` objects.

Includes QUnit tests.

Props celloexpressions, westonruter, ocean90.
Fixes #30737.

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

Props dlh.
Fixes #32536.

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

Props celloexpressions, westonruter, ocean90.
See #30737.


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

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

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

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

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

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

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

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

See #20459, #21730.

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

Fixes #32517.


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

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

Props realloc.
Fixes #32281.


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

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

Add unit tests for widgets.

Fixes #32474.



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

Props sudar, mordauk.
Fixes #14156.

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

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

Props DrewAPicture.
Fixes #32243.

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

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

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


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

Fixes #32026.


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

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

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

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

Fixes #31126


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

Props willgladstone.
Fixes #32081.

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



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

See #32090.



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

See #32165.



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

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

Fixes #31939.

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

Fixes #32260.

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

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

Fixes #32248.

git-svn-id: https://develop.svn.wordpress.org/trunk@32353 602fd350-edb4-49c9-b593-d223f7449a82
2015-05-05 11:13:51 +00:00
Aaron Jorbin d0567838e4 Update QUnit to v1.18.0
See https://github.com/jquery/qunit/blob/1.18.0/History.md for changes from 1.12.0 to now.  Mostly bug fixes and internal changes in preparation for QUnit v2.

See #30824



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

See [31614] #15928 for background.

Fixes #32112 for trunk.

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

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

Props sc0ttkclark.
Fixes #32224.

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

Fixes #31724.

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

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

Props mordauk, boonebgorges.
Fixes #25143.

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

Props stevegrunwell, hrishiv90, boonebgorges.
Fixes #21881.

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



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



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



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

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

Props imath.
Fixes #32019.

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

Fixes #32025.



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



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



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

See #21212.



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

Fixes #31994.

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

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



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

See #31709.



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

See #31709.



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

Props valendesigns.
Fixes #30266.

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

Fixes #30910.

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

Fixes #31878.

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

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


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

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

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



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

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

Props tyxla.
Fixes #31306.


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

Props miqrogroove.
Fixes #30344.


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

Props rittesh.patel, DrewAPicture.
Fixes #30647.


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

See #31262 for more discussion.



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


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

See #31719.



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

Fixes #31719.



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

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

See #31705.

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

Props ianmjones.
See #31705.

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

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

Props westonruter, morganestes, boonebgorges.
Fixes #24826.

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

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

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

See #31328.

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

See #31242



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

See #31130.

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


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

Fixes #31328



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

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

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

See #31242



git-svn-id: https://develop.svn.wordpress.org/trunk@31733 602fd350-edb4-49c9-b593-d223f7449a82
2015-03-11 22:48:16 +00:00