Commit Graph

3398 Commits

Author SHA1 Message Date
Sergey Biryukov e76722f70f Tests: Change `group` annotation for `test_unique_filename_with_dimension_like_filename()` to `ticket.
See #42437.

git-svn-id: https://develop.svn.wordpress.org/trunk@46835 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 12:16:43 +00:00
Sergey Biryukov de38dfdd47 Tests: Make sure network factory returns an integer ID for created objects, for consistency with other factories and the documented value.
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46831 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 11:29:14 +00:00
Sergey Biryukov 102cb95559 Tests: Pad incrementors used in factories with leading zeros to make sure MySQL sorting works as expected.
Previously, tests could create sequential objects with names like `Term 99`, `Term 100`, which by default would be returned in reverse order when sorted by name alphabetically, causing seemingly random test failures that are extremely hard to debug.

See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46830 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 10:39:39 +00:00
Sergey Biryukov 0660804327 Tests: Speed up comment submission unit tests by creating less fixtures and reusing them where possible.
See #30017, #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46829 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-08 18:00:23 +00:00
Andrew Ozz 5464dcb2c5 Upload: fix `wp_unique_filename()` to prevent name collisions with existing or future image sub-size file names, and add unit tests.
Props Viper007Bond, pbiron, azaozz.
Fixes #42437.

git-svn-id: https://develop.svn.wordpress.org/trunk@46822 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 22:26:19 +00:00
John Blackbourn bcfccc7344 Docs: Correct various docblocks documentation.
See #48303

git-svn-id: https://develop.svn.wordpress.org/trunk@46821 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 22:21:07 +00:00
Sergey Biryukov 0c673c2308 Tests: Remove duplicate `test_get_page_by_path_priority()` test.
The test was moved into its own file in [37478], but never removed from its previous location.

See #36711.

git-svn-id: https://develop.svn.wordpress.org/trunk@46819 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-06 17:25:32 +00:00
Sergey Biryukov 4bd7b37ef9 Tests: Merge [24251] from `_wp_filter_build_unique_id()` to `_test_filter_build_unique_id()`, for consistency.
See #47407.

git-svn-id: https://develop.svn.wordpress.org/trunk@46806 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-29 22:15:31 +00:00
Sergey Biryukov 890bd870e8 Docs: Correct `@param` type for the function parameter in `tests_add_filter()` and `_test_filter_build_unique_id()`.
Synchronize documentation for `add_filter()`, `tests_add_filter()`, `_wp_filter_build_unique_id()`, `_test_filter_build_unique_id()`.

Add a note that `$tag` and `$priority` are no longer used in `_wp_filter_build_unique_id()` since [46220], and the function always returns a string now.

Props donmhico, remcotolsma, SergeyBiryukov.
Fixes #47407. See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46801 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-29 21:40:58 +00:00
Sergey Biryukov e720a9ddc7 Date/Time: Make `get_permalink()` more resilient against PHP timezone changes.
Overriding default PHP timezone with `date_default_timezone_set()`, while not recommended, should not inadvertently result in changing existing permalinks.

Add a unit test.

Props Rarst, steevithak, archon810, maciejmackowiak, Ov3rfly, Cybr, hometowntrailers, scvleon, miette49.
Fixes #48623.

git-svn-id: https://develop.svn.wordpress.org/trunk@46795 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-28 13:40:19 +00:00
Sergey Biryukov 9737e5fdc3 KSES: Add support for gradient backgrounds.
Props jorgefilipecosta.
Fixes #48376.

git-svn-id: https://develop.svn.wordpress.org/trunk@46793 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-28 00:27:21 +00:00
Sergey Biryukov 4159a41cef Tests: Add `feed` group for `get_feed_build_date()` test added in [46756].
See #48675.

git-svn-id: https://develop.svn.wordpress.org/trunk@46785 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-26 16:17:02 +00:00
Sergey Biryukov 6ce8175456 Date/Time: Remove `mysql2date()` usage in `get_feed_build_date()` to ensure the output includes correct timezone offset.
With the changes in [45908], `mysql2date()` works correctly for all local time inputs, but should not be used for UTC time inputs.

Add a unit test.

Props Rarst, lisota.
Fixes #48675.

git-svn-id: https://develop.svn.wordpress.org/trunk@46756 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-21 13:16:50 +00:00
Sergey Biryukov 3b54ab37ed Customize: If the return URL for Close button is a page added to the Appearance menu by a deactivated theme, fall back to the Themes screen.
Props JarretC, Jean-David, SergeyBiryukov.
Fixes #46686.

git-svn-id: https://develop.svn.wordpress.org/trunk@46754 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-20 18:47:08 +00:00
Sergey Biryukov 6c776ea07b Bundled Themes: Update copyright year in `readme.txt`.
Add a unit test to ensure the year stays up to date.

Props dkarfa, SergeyBiryukov.
Fixes #48566.

git-svn-id: https://develop.svn.wordpress.org/trunk@46719 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-12 17:34:05 +00:00
Jake Spurlock 91312ab695 Tests: Fix a typo in an inline comment.
Fix a regression from [46568].

Props david.binda.
See #48312.


git-svn-id: https://develop.svn.wordpress.org/trunk@46707 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-11 18:48:06 +00:00
Sergey Biryukov 1ee0c8e54f Customize: Remove the deprecated `-precomposed` suffix from `apple-touch-icon` link in `wp_site_icon()`.
Props mukto90, khag7.
Fixes #48555.

git-svn-id: https://develop.svn.wordpress.org/trunk@46698 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-11 09:58:17 +00:00
Sergey Biryukov cde71eed52 Docs: In various `@return` tags, list the expected type first, instead of `WP_Error`.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46696 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-11 02:41:15 +00:00
Sergey Biryukov 1b82ea8284 Tests: Don't skip the tests intended for Multisite when running on single site, add them to the `ms-required` group instead.
See #43438.

git-svn-id: https://develop.svn.wordpress.org/trunk@46693 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-10 01:53:17 +00:00
Sergey Biryukov 00aff3a706 Docs: Use 3-digit, x.x.x style semantic versioning for `$version` argument in `do_action_deprecated()` and `apply_filters_deprecated()` calls.
Props jrf.
Fixes #48255.

git-svn-id: https://develop.svn.wordpress.org/trunk@46689 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-09 13:55:43 +00:00
Sergey Biryukov 243d1a2e38 Test: Don't skip the tests intended for single site when running on Multisite, add them to the `ms-excluded` group instead.
See #39776, #45747.

git-svn-id: https://develop.svn.wordpress.org/trunk@46683 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-09 03:44:51 +00:00
Sergey Biryukov fcf86b80b6 Tests: Skip `test_readme()` if the HTTP request to `secure.php.net` or `dev.mysql.com` failed on timeout.
Move `skipTestOnTimeout()` to `WP_UnitTestCase_Base` to avoid duplication.

See #44613.

git-svn-id: https://develop.svn.wordpress.org/trunk@46682 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-09 03:36:19 +00:00
John Blackbourn a216b6d838 Toolbar: Un-deprecate the `WP_Admin_Bar::add_menu()` method.
This is only a wrapper for the `add_node()` method, but it's in widespread use both in core until [46642] and in thousands of plugins and themes. Deprecating it would have made sense when #19647 was originally opened but that's no longer the case.

Props whyisjake

Fixes #19647 


git-svn-id: https://develop.svn.wordpress.org/trunk@46678 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-08 13:17:35 +00:00
Sergey Biryukov 75f82d8bc2 Tests: Properly mark `test_submenu_helpers_priority()` as skipped for multisite, so it's not categorized as "risky".
See #39776.

git-svn-id: https://develop.svn.wordpress.org/trunk@46674 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-06 01:15:11 +00:00
Sergey Biryukov 9c3319de66 Coding Standards: Fix WPCS issues in [46670].
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46671 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-05 23:17:01 +00:00
John Blackbourn bd2130f367 REST API: Use explicit dates in a post ordering test to avoid indeterminate ordering.
See #48145


git-svn-id: https://develop.svn.wordpress.org/trunk@46670 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-05 22:39:37 +00:00
Sergey Biryukov 4a729f0498 REST API: Speed up pagination unit tests by creating less fixtures and reusing them where possible.
Includes minor documentation and code layout fixes for better readability.

See #30017, #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46657 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-05 20:41:12 +00:00
Sergey Biryukov 20165c2ffb Login and Registration: Simplify the test for `wp_signon()` added in [46640].
Make sure it actually tests the change in behavior, previously it passed both before and after the patch.

Add `wp_unslash()` to the last remaining instance of `$_POST['user_login']` that didn't have it.

See #38744.

git-svn-id: https://develop.svn.wordpress.org/trunk@46650 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-04 15:04:41 +00:00
Sergey Biryukov c231bb4869 Build/Test Tools: Adjust the test for `wp_redirect()` status codes added in [46641] per the documentation and coding standards.
Move the test to a more appropriate place for consistency with `wp_sanitize_redirect()` and `wp_validate_redirect()` tests.

See #44317.

git-svn-id: https://develop.svn.wordpress.org/trunk@46649 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-04 12:57:17 +00:00
Sergey Biryukov c04078ac9d REST API: Set `orderby` parameter in tax relation unit tests added in [46646].
The default value of `date` caused a race condition resulting in random test failures.

See #44326.

git-svn-id: https://develop.svn.wordpress.org/trunk@46648 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-04 12:34:35 +00:00
Timothy Jacobs a104c82526 REST API: Add tax relation parameter to posts collection.
The REST API supports filtering by terms across multiple taxonomies using an AND relation. This adds support for an OR relation by adding "tax_relation=OR" as a query parameter.

Props earnjam.
Fixes #44326.


git-svn-id: https://develop.svn.wordpress.org/trunk@46646 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 23:12:44 +00:00
Aaron Jorbin 20d984f4c9 Remove Failing Tests added in r46641
The tests for good redirects send headers that we can't handle in the test suite, so let's just remove them.

Unprops Jorbin.
Fixes #44317.



git-svn-id: https://develop.svn.wordpress.org/trunk@46645 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 22:47:52 +00:00
John Blackbourn 27b67d5624 Docs: Fix some incorrect return tags in docblocks.
See #48303


git-svn-id: https://develop.svn.wordpress.org/trunk@46644 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 22:21:20 +00:00
Jake Spurlock 83366144b3 Coding Standards: Clean up the tests around `test_that_you_can_login_with_an_email_that_has_apostrophe`.
Let's use the proper coding standards for the comments.

Fixes #38744.
Props cafenoirdesign.


git-svn-id: https://develop.svn.wordpress.org/trunk@46643 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 22:16:27 +00:00
Jake Spurlock 922721c360 Toolbar: Use `add_node()` instead of `add_menu()` in core.
This patch replaces all references to the add_menu() method with the add_node() one. (Also some code structure modifications for wp_admin_bar_appearance_menu().)

Fixes: #19647
Props: linuxologos, paulschreiber, morganestes, akibjorklund, nacin, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@46642 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 22:12:32 +00:00
Aaron Jorbin 40946e984a General: wp_safe_redirect() and wp_redirect() shouldn't allow non-3xx status codes
Redirects should use redirect status codes and if you attempt to call wp_safe_redirect or wp_redirect with a non redirect status it can lead to undesired behavior and head scratching.

Fixes #44317.
Props spenserhale, johnbillion, mjnewman for initial patch.



git-svn-id: https://develop.svn.wordpress.org/trunk@46641 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 22:08:56 +00:00
Jake Spurlock 84c794ba41 Login and Registration: Allow email logins to be more flexible.
Allows a login to have an apostorphe. Which would normally be created as a mistake, but this allows the login to happen.

Fixes #38744
Props wpkuf, desrosj, socalchristina, bibliofille, santilinwp, nsubugak, sncoker, cafenoirdesign, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@46640 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-03 20:10:23 +00:00
Sergey Biryukov 89621877f8 Code Modernization: Pass an appropriate error level to `trigger_error()` in `_doing_it_wrong()` and related functions:
* `_deprecated_function()`
* `_deprecated_argument()`
* `_deprecated_constructor()`
* `_deprecated_file()`

The error level passed is `E_USER_DEPRECATED` for the deprecated function group and `E_USER_NOTICE` for `_doing_it_wrong()`.

Props jrf.
Fixes #36561.

git-svn-id: https://develop.svn.wordpress.org/trunk@46625 602fd350-edb4-49c9-b593-d223f7449a82
2019-11-01 00:39:04 +00:00
Sergey Biryukov b0419afba6 Build/Test Tools: Ignore EOL differences in tests using multiline string assertions.
Unix vs. Windows EOL style mismatches can cause misleading failures in tests using the heredoc syntax (`<<<`) or multiline strings as the expected result.

Fixes #31432. See #42594, #47411.

git-svn-id: https://develop.svn.wordpress.org/trunk@46612 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-29 14:26:41 +00:00
Jonathan Desrosiers 10c787f0ca Ensure `svn:eol-style` is consistently set for all files (part 2).
Continuation of [46586]

See #42594.

git-svn-id: https://develop.svn.wordpress.org/trunk@46587 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 19:27:49 +00:00
Jonathan Desrosiers d376fedd89 Ensure `svn:eol-style` is consistently set for all files.
See #42594.

git-svn-id: https://develop.svn.wordpress.org/trunk@46586 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 16:36:41 +00:00
Jonathan Desrosiers 3646ed75c1 Remove the `svn:executable` property from files that don't need it.
See #42594.

git-svn-id: https://develop.svn.wordpress.org/trunk@46585 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 15:34:43 +00:00
Sergey Biryukov ee5227550d Date/Time: Remove incomplete and redundant test for `get_post_time()` added in [46580].
There is no functional difference between `gmt_offset` and `timezone_string` timezone modes for the issue.

See #48384.

git-svn-id: https://develop.svn.wordpress.org/trunk@46583 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 15:09:30 +00:00
Sergey Biryukov c67b47c66e Date/Time: Make sure `get_post_time()` keeps UTC time on timezone change.
Add `$source` parameter to `get_post_datetime()` to instantiate from local or UTC time in database.

Props Rarst, david.binda.
Reviewed by azaozz, SergeyBiryukov.
Fixes #48384.

git-svn-id: https://develop.svn.wordpress.org/trunk@46580 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 13:06:29 +00:00
Sergey Biryukov 38b4ecf2ed Date/Time: Make sure `date_i18n()` correctly handles zero timestamp after [45901].
Props soulseekah, gravityview, Rarst.
Reviewed by azaozz, SergeyBiryukov.
Fixes #28636.

git-svn-id: https://develop.svn.wordpress.org/trunk@46577 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-25 11:03:13 +00:00
SergeyBiryukov 747f8e2186 Date/Time: Make sure `wp_date()` does not unnecessarily escape localized numbers, but keeps localized slashes.
Props Rarst, tmatsuur, remcotolsma, peterwilsoncc.
Reviewed by peterwilsoncc.
Fixes #48319.

git-svn-id: https://develop.svn.wordpress.org/trunk@46569 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-22 17:29:02 +00:00
Sergey Biryukov 99d5986b0c Plugins: Restore backward compatibility for PHP4-style passing of `array( &$this )` as action argument to `do_action()`.
This is a follow-up to [46149] to avoid unnecessary breakage in case of using the old notation.

Props david.binda, jrf.
Reviewed by azaozz.
Fixes #48312.

git-svn-id: https://develop.svn.wordpress.org/trunk@46568 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-22 00:09:39 +00:00
Sergey Biryukov 1f7f0a1357 Comments: Add `rel="nofollow ugc"` attribute when converting plain URLs to `<a>` tags in comments via `make_clickable()`.
Introduce `make_clickable_rel` filter for the `rel` value that is added to URL matches converted to links.

This is a follow-up to [46349], which added the `rel="nofollow ugc"` attribute to existing `<a>` tags in comments via `wp_rel_ugc()`.

UGC stands for User Generated Content, and the `ugc` attribute value is recommended for links within user generated content, such as comments and forum posts.

See https://webmasters.googleblog.com/2019/09/evolving-nofollow-new-ways-to-identify.html.

Props blogginglife, SergeyBiryukov.
Reviewed by desrosj, audrasjb.
Fixes #48022.

git-svn-id: https://develop.svn.wordpress.org/trunk@46564 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-21 20:39:16 +00:00
K. Adam White 56aa018065 REST API: Cast empty meta values to correct scalar types in REST response.
Introducing complex meta value handling in [45807] unintentionally removed value casting for empty scalar meta values.

Props TimothyBlynJacobs, chrisvanpatten, rmccue, kadamwhite.
Fixes #48363.



git-svn-id: https://develop.svn.wordpress.org/trunk@46563 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-21 19:08:34 +00:00
Sergey Biryukov 943fa44db0 Shortcodes: Revert [46369] for now to allow more time to investigate and prepare for backward compatibility changes.
Also reverts follow-up changes in [46370] and [46465].

See #47863.

git-svn-id: https://develop.svn.wordpress.org/trunk@46554 602fd350-edb4-49c9-b593-d223f7449a82
2019-10-15 19:34:31 +00:00