Commit Graph

2438 Commits

Author SHA1 Message Date
Peter Westwood 4741b13009 Tests: Rename this file to match our coding standards.
git-svn-id: https://develop.svn.wordpress.org/trunk@41029 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-12 20:55:36 +00:00
Sergey Biryukov e4bfc8ca90 Shortcodes: Allow using single quotes for empty value attributes.
Props enrico.sorcinelli.
Fixes #37304.

git-svn-id: https://develop.svn.wordpress.org/trunk@41026 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-11 00:53:33 +00:00
Adam Silverstein 33755709e4 Date/Time: Add unit tests for the `human_time_diff` function.
Verify that `human_time_diff` works as expected for minute, hour and day intervals. Test that rounding works as expected when the time difference is near the rounding margin.

Props SGr33n.
Fixes #38773.


git-svn-id: https://develop.svn.wordpress.org/trunk@41018 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-07 17:07:40 +00:00
Sergey Biryukov bb6e34a7fd Media: Use a filename instead of a URL in image header tests to avoid triggering an outbound HTTP request causing an ImageMagick exception on some configurations.
Props danielbachhuber.
Fixes #41216.

git-svn-id: https://develop.svn.wordpress.org/trunk@41017 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-07 00:06:36 +00:00
Sergey Biryukov 50735b09f1 Media: Correct the order of arguments passed to assertions in `Tests_Image_Header`.
Props danielbachhuber.
See #41216.

git-svn-id: https://develop.svn.wordpress.org/trunk@41016 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 23:57:31 +00:00
Weston Ruter f67018c059 Customize: Prevent edge case fatal error when attempting to save changes to a changeset that had previously been corrupted.
Check return value of `WP_Customize_Manager::get_changeset_post_data()` and return if error instead of assuming it is an array.

Amends [38810].
See #30937.
Fixes #41252.


git-svn-id: https://develop.svn.wordpress.org/trunk@41012 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 07:04:11 +00:00
Ryan McCue 8b5c4ae745 REST API: Fix brittle search test.
This was previously searching for the user ID, which isn't really what it was meant to do. As a result, the test can break if that number appears in any other user information.


git-svn-id: https://develop.svn.wordpress.org/trunk@41011 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-06 01:34:40 +00:00
Sergey Biryukov a828890ce2 Menus: Make sure `current-menu-parent` and `current-menu-ancestor` classes are properly set for parent items of post type archive submenu items.
Props mrwweb, ajoah, welcher.
Fixes #39800.

git-svn-id: https://develop.svn.wordpress.org/trunk@41008 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 21:30:30 +00:00
James Nylen 0b3663b0a2 Ensure that `wp-api.js` test fixtures do not change with `WP_TESTS_*` constants.
Previously, changing these constants in `wp-tests-config` would cause PHPUnit to regenerate `wp-api-generated.js` with different values.

This commit uses the existing mechanism to also "freeze" all values that would change as a result of changing these constants.

Fixes #41123.


git-svn-id: https://develop.svn.wordpress.org/trunk@41006 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-05 09:29:58 +00:00
Boone Gorges c806540943 Avoid PHP notices when checking termmeta capabilities against a non-existent term.
Previously, checks like `current_user_can( 'edit_term_meta', $term_id )`
returned the proper value, but generated a PHP notice due to the fact
that `get_term( $term_id )` could, in certain instances, return
`WP_Error` objects.

Props caercam.
Fixes #40891.

git-svn-id: https://develop.svn.wordpress.org/trunk@40999 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-04 19:58:35 +00:00
Boone Gorges a16d16449d Introduce `wp_get_object_terms_args` filter.
This filter allows developers to modify the arguments passed to
`wp_get_object_terms()` before the query is run.

Props enrico.sorcinelli.
Fixes #35925.

git-svn-id: https://develop.svn.wordpress.org/trunk@40994 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-02 18:28:21 +00:00
Peter Wilson 3a4ffa09ab Capabilities: Prevent users having the `do_not_allow` capability.
Meta capabilities use the capability `do_not_allow` to indicate a user should be blocked from performing a particular action. This ensures users can not have the capability as it would cause unexpected behaviour.

Props johnbillion.
Fixes #41059.



git-svn-id: https://develop.svn.wordpress.org/trunk@40993 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-02 05:15:42 +00:00
Boone Gorges 6bf8783afd Allow user searches to match the `display_name` field.
Props bcole808, pcarvalho.
Fixes #39643.

git-svn-id: https://develop.svn.wordpress.org/trunk@40982 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-01 14:21:50 +00:00
Boone Gorges 107c937394 Allow metadata to be updated via `wp_update_comment()`.
Passing an array of `comment_meta` into `wp_update_comment()` will
now update corresponding metadata. Similar functionality already
exists in `wp_insert_comment()`.

Props dshanske, kraftbj.
Fixes #36784.

git-svn-id: https://develop.svn.wordpress.org/trunk@40981 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-01 13:35:38 +00:00
Boone Gorges 1721af83d1 Taxonomy: Ignore cached term value when it doesn't match the queried taxonomy.
When a cache entry is found that matches the requested `$term_id`, but
doesn't match an explicitly provided `$taxonomy`, that cache entry
should be ignored.

Props GunGeekATX.
Fixes #40671.

git-svn-id: https://develop.svn.wordpress.org/trunk@40979 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-01 11:45:09 +00:00
Boone Gorges a5001396ad Introduce `$comment_count` param for `WP_Query`.
This parameter allows querying for posts with a specific value of
`comment_count`. It is also possible to query for posts that match
a `comment_count` comparison by passing an array with 'value' and
'compare' operators (eg `array( 'compare' => '>', 'value' => 5 )`).

Props ramon fincken.
Fixes #28399.

git-svn-id: https://develop.svn.wordpress.org/trunk@40978 602fd350-edb4-49c9-b593-d223f7449a82
2017-07-01 11:24:26 +00:00
Drew Jaynes 626f78750b Tests: Add `@method` notations to factor class DocBlocks as a way to indicate expected return types from factory methods for the benefit of IDEs.
Props jdgrimes.
Fixes #37867.


git-svn-id: https://develop.svn.wordpress.org/trunk@40968 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-30 04:35:39 +00:00
Sergey Biryukov 21a6c7b050 Cron API: Introduce `wp_unschedule_hook()` to clear all events attached to a hook.
This complements `wp_clear_scheduled_hook()`, which only clears events attached with specific arguments.

Props arena, mordauk, jrf.
Fixes #18997.

git-svn-id: https://develop.svn.wordpress.org/trunk@40965 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-30 00:21:49 +00:00
Weston Ruter d29e68fbda Widgets: Rename "HTML Code" widget to "Custom HTML" widget.
Correspondingly renames files, ID base from `html_code` to `custom_html`, and the filter from `widget_html_code_content` to `widget_custom_html_content`.

See #40907.


git-svn-id: https://develop.svn.wordpress.org/trunk@40926 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-23 23:59:23 +00:00
Boone Gorges ddc823a3e9 Cache results in `get_objects_in_term()`.
This helps to reduce database queries when generating nav menus.

Props spacedmonkey.
Fixes #37094.

git-svn-id: https://develop.svn.wordpress.org/trunk@40921 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-22 03:18:18 +00:00
Boone Gorges deae2f7cbf Use `WP_Term_Query` when transforming tax queries.
This change allows tax query transformations to be cached.

Props spacedmonkey.
Fixes #37038.

git-svn-id: https://develop.svn.wordpress.org/trunk@40918 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-21 03:56:25 +00:00
Boone Gorges 03cd8d5b70 Add term meta support to XML-RPC `addTerm` and `editTerm` endpoints.
This changeset also includes the new function `has_term_meta()`, a
counterpart to `has_meta()` (for posts).

Props enrico.sorcinelli.
Fixes #35991.

git-svn-id: https://develop.svn.wordpress.org/trunk@40916 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-18 10:39:12 +00:00
Weston Ruter 5b7fb84f03 Widgets: Add widget dedicated for HTML Code, taking over this role of the Text widget.
Props westonruter, timmydcrawford.
See #40951, #35243.
Fixes #40907.


git-svn-id: https://develop.svn.wordpress.org/trunk@40893 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-09 23:53:27 +00:00
Weston Ruter d3226f6041 Media: Restrict appending `loop` parameter to Vimeo URLs specifically and not all external URLs in Video widget (via shortcode).
Fixes issue where Video widgets embedding external files fail to get recognized due to the presence of the `loop` param after the video filename, even though it has a recognized extension. Regardless, the `loop` param is only present to fix a Vimeo issue in ME.js 2.x.

Props timmydcrawford.
Amends [40640].
See #39686, #39994.
Fixes #40977.


git-svn-id: https://develop.svn.wordpress.org/trunk@40892 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-09 19:28:12 +00:00
John Blackbourn cc01df2bc8 Build/Test Tools: I don't know how this happened.
See #39822


git-svn-id: https://develop.svn.wordpress.org/trunk@40873 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-02 14:10:56 +00:00
John Blackbourn 0ab7067286 Build/Test Tools: Fix PHP 5.2 compatibility for grandchild methods which expect exceptions to be raised.
This is due to `is_callable( 'parent::setExpectedException' )` not being supported on PHP 5.2 when the method being checked only exists on the grandparent class.

Props jdgrimes

See #39822


git-svn-id: https://develop.svn.wordpress.org/trunk@40872 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-02 13:17:30 +00:00
John Blackbourn d4218aae7f Build/Test Tools: Add a missing class to the PHPUnit 6 back compat.
See #39822


git-svn-id: https://develop.svn.wordpress.org/trunk@40853 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-30 22:06:56 +00:00
Weston Ruter 289965b097 Widgets: Normalize YouTube and Vimeo URLs in `video` shortcode (primarily for Video widget) to work around ME.js 2.22 bug.
Props timmydcrawford, jnylen0, westonruter.
See #32417, #39994.
Fixes #40866.


git-svn-id: https://develop.svn.wordpress.org/trunk@40847 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-26 23:09:42 +00:00
James Nylen 299a140fb7 Revert [40842] due to failing tests.
See #19629.


git-svn-id: https://develop.svn.wordpress.org/trunk@40844 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-25 18:27:08 +00:00
Mike Schroder cbc3829b62 Media: Introduce tests for `media_sideload_image()`.
Adds basic tests for `media_sideload_image()`, including testing
the return arguments.

Props westonruter, mikeschroder.
Fixes #19629.

git-svn-id: https://develop.svn.wordpress.org/trunk@40842 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-25 18:00:28 +00:00
Peter Wilson e0013072d1 Emoji: Add Emoji 5 support.
Updates Twemoji to 2.3.0 to include Emoji 5 support.

The pride flag test is replaced with a test for the English flag, a five character sub-devision locale. The UN flag test is retained as the most recent two character locale.

An Emoji 5 "bearded person" replaces both Emoji 4 tests.

Fixes #40858.



git-svn-id: https://develop.svn.wordpress.org/trunk@40837 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-25 07:17:57 +00:00
Konstantin Obenland f8dabb5b35 Themes: Skip tests if ReflectionMethod::setAccessible is unavailable
See [40825].


git-svn-id: https://develop.svn.wordpress.org/trunk@40826 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-23 22:15:08 +00:00
Konstantin Obenland 38c32bdcdb Themes: More unit tests for Custom Header
Custom Header functionality is largely untested. This adds tests for existing
behavior as well as changes introduced in [39227].

Props bradyvercher.
See #38639.
Fixes #39241.


git-svn-id: https://develop.svn.wordpress.org/trunk@40825 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-23 20:55:16 +00:00
Andrea Fercia 181ecf1ec3 Themes: Improve the theme Custom Logo accessibility.
Uses the Site title as fallback value for the Custom Logo alt attribute when the original alt attribute is empty.

Props sami.keijonen, joedolson, sstoqnov, nobremarcos, gma992, LiamMcArthur, jjcomack.
Fixes #38768.


git-svn-id: https://develop.svn.wordpress.org/trunk@40817 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-22 20:28:43 +00:00
Andrea Fercia 9e969efb89 Widgets: Remove the title attributes used in the Tag cloud widget.
- improves accessibility using an aria-label attribute to match the information conveyed visually with the one exposed to assistive technologies
- adds an option in the widget to display the item counts, consistently with what other widgets already do (Archives, Categories)

Props adamsoucie, emirpprime, Samantha Miller., MikeLittle, rianrietveld, sami.keijonen, adamsilverstein, westonruter, afercia.
See #24766.
Fixes #35566.


git-svn-id: https://develop.svn.wordpress.org/trunk@40816 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-22 20:23:49 +00:00
James Nylen 5ea3c91d57 REST API: Fix changing parameters with `set_param()` for some requests.
Prior to this commit, `WP_Rest_Request::get_param()` traversed through the parameter order but `WP_Rest_Request::set_param()` did not. For JSON requests (and likely other situations as well), this meant that changing a parameter with `set_param()` would have no effect on `get_param()`.

Props TimothyBlynJacobs.
Fixes #40344.



git-svn-id: https://develop.svn.wordpress.org/trunk@40815 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-22 16:15:25 +00:00
Mike Schroder 2a5f7a8901 Media: Decode HTML entities in `author_name` before sending to JS.
In `wp_prepare_attachment_for_js()`:
- Normalize behavior when author does not exist by returning '(no author)' for `authorName` in these cases.
- Decode HTML entities in `author_name`.
- Add tests for both of the above.

Props arshidkv12, ocean90, sloisel, mikeschroder.
Fixes #39955.

git-svn-id: https://develop.svn.wordpress.org/trunk@40809 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-20 02:23:00 +00:00
James Nylen ce38b9c90a REST API: Avoid sending blank `Last-Modified` headers with authenticated requests.
This commit adds a new `WP_REST_Server#remove_header` method and uses it to clear the `Last-Modified` header when the "no caching" headers are sent (by default for all authenticated REST API requests).  This matches the behavior of the `nocache_headers` function used in other parts of WordPress.

Previously, the REST API would send an empty `Last-Modified` header in this situation.  Under some server and browser configurations, this causes browsers to cache authenticated REST API requests, which is undesirable.

Props iv3rson76, zinigor, rmccue, jnylen0.
Fixes #40444.


git-svn-id: https://develop.svn.wordpress.org/trunk@40805 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-19 20:26:48 +00:00
Joe McGill 11acb32acf Media: Ensure WP_Screen sets post type on wp-admin/upload.php.
The post type property is set to 'attachment' when on the upload screen.

Props postpostmodern.
Fixes #39509.


git-svn-id: https://develop.svn.wordpress.org/trunk@40800 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-19 18:28:58 +00:00
Weston Ruter fe789a2644 Customize: Fix phpunit tests after [40704] due to logic inversion error.
git-svn-id: https://develop.svn.wordpress.org/trunk@40716 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-16 14:33:16 +00:00
Weston Ruter 77fe870bd5 Customize: Keep alive auto-drafts created for page/post stubs when parent changeset is updated, and delete when changeset is garbage-collected.
Props utkarshpatel, westonruter.
See #31089.
Fixes #39715.


git-svn-id: https://develop.svn.wordpress.org/trunk@40676 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-16 05:36:25 +00:00
Weston Ruter 556e793ed6 Widgets: Remove image sizes generated during media widget phpunit tests from being version controlled.
Amends [40640].
See #32417.


git-svn-id: https://develop.svn.wordpress.org/trunk@40674 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-15 22:58:03 +00:00
Weston Ruter 74128e0e3f Widgets: Ensure return value of `widget_text` filter is not dropped but passed into `widget_text_content` filter for rendering.
Amends [40631].
Props vijustin, swissspidy, westonruter.
See #35243.
Fixes #40772.



git-svn-id: https://develop.svn.wordpress.org/trunk@40673 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-15 22:35:41 +00:00
Rachel Baker c52f1fb160 Formatting: Increase minimum characters allowed in `is_email()` to 6.
Brings the minimum characters expected for a valid email address to six, which matches the expectations in `wp_handle_comment_submission()` and REST API email arguments.

Props rmccue, lukecavanagh, rachelbaker, desrosj, sudar.
Fixes #38708.


git-svn-id: https://develop.svn.wordpress.org/trunk@40667 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-14 04:19:51 +00:00
Andrew Ozz 1d6af162c4 Revert [40256] for now as some tests are failing in some environments.
See #20383.

git-svn-id: https://develop.svn.wordpress.org/trunk@40661 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-12 22:49:48 +00:00
Dominik Schilling (ocean90) 0202bed74d Import: Replace `assert()` calls with PHPUnit's `assertTrue()` method.
Calling `assert()` with a string argument will be deprecated in PHP 7.2.

See #40109.

git-svn-id: https://develop.svn.wordpress.org/trunk@40649 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-12 07:37:33 +00:00
Weston Ruter da32c2f630 Widgets: Introduce media widgets for images, audio, and video with extensible base for additional media widgets in the future.
The last time a new widget was introduced, Vuvuzelas were a thing, Angry Birds started taking over phones, and WordPress stopped shipping with Kubrick. Seven years and 17 releases without new widgets have been enough, time to spice up your sidebar!

Props westonruter, melchoyce, obenland, timmydcrawford, adamsilverstein, gonom9, wonderboymusic, Fab1en, DrewAPicture, sirbrillig, joen, matias, samikeijonen, afercia, celloexpressions, designsimply, michelleweber, ranh, kjellr, karmatosed.
Fixes #32417, #39993, #39994, #39995.


git-svn-id: https://develop.svn.wordpress.org/trunk@40640 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 21:10:54 +00:00
Dominik Schilling (ocean90) d880e60f11 KSES: Support `'tag' => true` as a shorthand for `'tag' => array()` in `wp_kses_attr()`.
`Automatic_Upgrader_Skin::feedback()` had always assumed that this is already the case, now it is.

See #20017.
Fixes #40680.

git-svn-id: https://develop.svn.wordpress.org/trunk@40637 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 19:22:17 +00:00
Pascal Birchler ec6de050b7 Posts, Post Types: Add initial tests for `get_post_type_labels()`.
See #38218.
Fixes #38157.


git-svn-id: https://develop.svn.wordpress.org/trunk@40635 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 19:18:53 +00:00
Pascal Birchler a619778c3b Mail: Ensure entities are decoded in email change notifications on Multisite.
Adds new tests to ensure this bug does not pop up again.

Props stephenharris.
Fixes #40015.


git-svn-id: https://develop.svn.wordpress.org/trunk@40632 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 19:14:55 +00:00