Commit Graph

2828 Commits

Author SHA1 Message Date
Sergey Biryukov 0711e585fb Media: After [42693], update HTML4 markup in `img_caption_shortcode()` to avoid an empty ID attribute as well.
Add a unit test for `aria-describedby` in `img_caption_shortcode()`.

See #34595.

git-svn-id: https://develop.svn.wordpress.org/trunk@42694 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-11 15:39:20 +00:00
Helen Hou-Sandi 05b37069a4 Options: Use strings in the test suite that follow community guidelines.
Also somewhat explain to future maintainers why this pairing of strings was chosen, besides this committer's musical preferences. Social opinions on cancer are fairly clear, as are commonly accepted definitions of profanity and family-friendly language.

Shout out to the close contender, which would have been particularly appropriate here: "You could be the king // But watch the queen conquer".

see #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42667 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 22:41:48 +00:00
Aaron Jorbin 2c6f1b18f4 Options: Use most appropriate language in the test suite.
The test suite's opinion of cancer should be clear.

Reverts r42659.

See #43207, #38176




git-svn-id: https://develop.svn.wordpress.org/trunk@42663 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 20:58:21 +00:00
John Blackbourn 9b46512501 Options: Use more appropriate language in the test suite.
See #43207, #38176


git-svn-id: https://develop.svn.wordpress.org/trunk@42659 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-07 18:51:55 +00:00
Felix Arntz ea13c56d7f Options: Unhook default option filter when setting is unregistered.
Fixes #43207.


git-svn-id: https://develop.svn.wordpress.org/trunk@42655 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-06 14:48:46 +00:00
John Blackbourn d512973c84 Canonical: Add `$x_redirect_by` parameter to `wp_safe_redirect()`.
See [42633] and [42408].

Fixes #42313.


git-svn-id: https://develop.svn.wordpress.org/trunk@42647 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-04 16:04:10 +00:00
Drew Jaynes 311531a964 Tests: Simplify `@covers` annotations for `WP_Error` test coverage. Also fix a typo in a test method name.
See #42742.


git-svn-id: https://develop.svn.wordpress.org/trunk@42646 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:37:51 +00:00
Drew Jaynes 86d486d67d Tests: Fix two typos introduced for a get_term_field() test in [35270].
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@42645 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-03 17:10:51 +00:00
Sergey Biryukov 59e1b7318d Tests: Correct erroneous `@covers` and `@use` tags.
Props jipmoors.
Fixes #43203.

git-svn-id: https://develop.svn.wordpress.org/trunk@42636 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:08:04 +00:00
Sergey Biryukov 07bff5d8bd Tests: Improve tests for `wp_get_post_parent_id()` added in [42397].
Props frank-klein.
Fixes #42797.

git-svn-id: https://develop.svn.wordpress.org/trunk@42635 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 16:02:26 +00:00
Sergey Biryukov 40f76ae917 Canonical: Add `$x_redirect_by` parameter to `wp_redirect()` that allows applications doing the redirect to identify themselves.
This complements the `x_redirect_by` filter added in [42408].

Props NathanAtmoz, johnbillion.
Fixes #42313.

git-svn-id: https://develop.svn.wordpress.org/trunk@42633 602fd350-edb4-49c9-b593-d223f7449a82
2018-02-01 15:05:50 +00:00
Adam Silverstein 1c4f57f425 Remove unit tests for deprecated ajax tag search function.
Fixes unit tests failing since r42614.

Ammends [42614].
See #38922.


git-svn-id: https://develop.svn.wordpress.org/trunk@42619 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 02:28:14 +00:00
Weston Ruter bba8d65216 Widgets: Fix Text widget unit test which broke due to global scope not being cleaned.
Amends [42613].
See #42495.


git-svn-id: https://develop.svn.wordpress.org/trunk@42617 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 00:33:03 +00:00
Weston Ruter 0e818c7aee Customize: Ensure `customize_autosaved` requests only use revision of logged-in user.
Props dlh, westonruter.
See #42433, #39896.
Fixes #42450.


git-svn-id: https://develop.svn.wordpress.org/trunk@42615 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-30 00:20:37 +00:00
Weston Ruter 07e4b7565e Customize: Ensure media playlists get initialized after selective refresh; expose new `wp.playlist.initialize()` API.
In particular allows audio and video playlists to be added to the Text widget and previewed.

Props bpayton, westonruter.
See #40854.
Fixes #42495.


git-svn-id: https://develop.svn.wordpress.org/trunk@42613 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-29 23:55:44 +00:00
Weston Ruter b31563e561 Customize: Include nav menu item for Home custom link in search results for "Home".
Props audrasjb, westonruter.
Fixes #42991.


git-svn-id: https://develop.svn.wordpress.org/trunk@42611 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-29 22:09:55 +00:00
Aaron Jorbin 47f6031fbd Query: Improve tests for set_found_posts dealing with non arrays
Use a data provider and include tests for `false` and `''`.

Previous: [42581] [42585]

See #42860



git-svn-id: https://develop.svn.wordpress.org/trunk@42594 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 20:51:06 +00:00
Sergey Biryukov dd9122b011 Tests: Update emoji base URL in `Tests_Formatting_Emoji` after [42590].
See #42862.

git-svn-id: https://develop.svn.wordpress.org/trunk@42592 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 17:25:03 +00:00
Gary Pendergast 33a3d61b22 Tests: Improve the old date redirect tests.
Props frank-klein.
See #15397.



git-svn-id: https://develop.svn.wordpress.org/trunk@42587 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 06:38:58 +00:00
Dion Hulse f35ed94605 Tests: Skip newly added tests from [42581] on PHP 5.2 as they require ReflectionMethod.
See #42860.


git-svn-id: https://develop.svn.wordpress.org/trunk@42585 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 04:20:26 +00:00
Aaron Jorbin 818a0f1ccf Query: Fix warning on counting non countable
Adds tests to continue the behavior for both null and strings.

See https://wiki.php.net/rfc/counting_non_countables for information on the PHP change.

Fixes #42860.
Props janak007 and ayeshrajans for initial patches.





git-svn-id: https://develop.svn.wordpress.org/trunk@42581 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-24 01:20:24 +00:00
Peter Wilson ec8734bc2e REST API: Update the fixture data for `wp-api.js` tests following [42359].
Props danielbachhuber.
See #41014.



git-svn-id: https://develop.svn.wordpress.org/trunk@42540 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-22 06:33:02 +00:00
Dion Hulse 2cb36cab72 General: Allow `wp_list_pluck()` to operate on arrays of references without overwriting the referenced items.
Fixes #16895.


git-svn-id: https://develop.svn.wordpress.org/trunk@42527 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-18 05:17:23 +00:00
Dion Hulse ade2dd5dfe Tests: Remove redundant `assertEquals()` calls in listFilter tests.
As these tests are already validating that two arrays match, checking that the counts also match before is redundant and makes it harder to debug when the test fails.

See #16895


git-svn-id: https://develop.svn.wordpress.org/trunk@42526 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-18 05:14:28 +00:00
Pascal Birchler 95ec25564b Posts, Post Types: Add tests for `get_post_type_labels()`.
These were accidentally omitted in [38157].

See #38157.


git-svn-id: https://develop.svn.wordpress.org/trunk@42490 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-16 08:32:55 +00:00
Sergey Biryukov 70dc1d9256 Media: Add `small-audio.flac` for a unit test added in [42451].
See #42225.

git-svn-id: https://develop.svn.wordpress.org/trunk@42453 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:32:47 +00:00
Sergey Biryukov 02ccaeed2c Media: Add `flac` to the list of allowed file types.
Props blobfolio.
Fixes #42225.

git-svn-id: https://develop.svn.wordpress.org/trunk@42451 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-15 22:16:33 +00:00
Peter Wilson 2b56623d89 Formatting: Do not run formatting and texturization on author bios.
Removes the formatting and texturization added to author bios in #40040 due to back-compatibility concerns.

Reverts [41172], [41173].

Props 0x6f0, rabmalin for review.
Fixes #42578.



git-svn-id: https://develop.svn.wordpress.org/trunk@42441 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-13 01:10:56 +00:00
Andrea Fercia 1258d1d9d2 Accessibility: use `aria-current` for the paginated post links output by `wp_link_pages()`.
Continues the introduction in core of the aria-current attribute after [41683], [41359], and [41371].

- changes the `wp_link_pages()` (see the `nextpage` quicktag) output to use an `aria-current` attribute on the current item
- adds `post-nav-links` and `post-page-numbers` CSS classes to help themes style these links
- updates the related tests

Props antonioeatgoat, alexstine.
Fixes #41859.


git-svn-id: https://develop.svn.wordpress.org/trunk@42440 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-12 20:16:56 +00:00
Mike Schroder 07d244a054 Media: Skip `test_remove_orientation_data_on_rotate` if missing deps.
The `test_remove_orientation_data_on_rotate()` test was failing on systems that did not have the `exif` extension available.

Skips test when the `exif_read_data()` function does not exist.

Props danielbachhuber, desrosj.
Fixes #42447.

git-svn-id: https://develop.svn.wordpress.org/trunk@42431 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-10 01:16:56 +00:00
Gary Pendergast 9cf7385eb3 Formatting: Fix capital_P_dangit() not capital P-ing, dangit.
Unfortunately, in my overzealous desire to fix all the un-capitalised Ps, [42343] capitalled some Ps that intentionally should not be capitals.

This commit fixes the incorrectly capitalling of Ps, as well as including unit tests and PHPCS instructions to ensure we never capitulate to capitalisationing them again.

Props superdav42.
Fixes #43040.
Fixes #43041.



git-svn-id: https://develop.svn.wordpress.org/trunk@42429 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-08 10:35:13 +00:00
Rachel Baker ab58308a41 REST API: Adjust unit testes to expect a 401 status code in error responses from permission callbacks when user is not authenticated.
Missed in [42421].

Fixes #42828.

git-svn-id: https://develop.svn.wordpress.org/trunk@42423 602fd350-edb4-49c9-b593-d223f7449a82
2018-01-01 02:30:39 +00:00
Boone Gorges 617372e21e Improve performance of `wp_list_pages()` tests.
The changeset also removes the use of hardcoded post/author IDs.

Props frank-klein.
Fixes #42903.

git-svn-id: https://develop.svn.wordpress.org/trunk@42402 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 11:15:00 +00:00
Gary Pendergast c07972d774 Canonical URLs: Redirect to the correct URL when the post date changes.
When a post slug is changed, we store a copy of the old slug, so that we can redirect visitors visiting the old URL to the new URL.

In the same way, this stores a copy of the old date, when the post date changes, so we can redirect visitors to the new URL.

Props nickmomrik.
Fixes #15397 for trunk.



git-svn-id: https://develop.svn.wordpress.org/trunk@42401 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 08:30:50 +00:00
Sergey Biryukov 4fbe6e0801 Docs: Add missing parameter description in `wp_get_post_parent_id()` function DocBlock.
Rename `$post_ID` to `$post` for consistency with other functions.

Add unit tests for `wp_get_post_parent_id()`.

Props keesiemeijer.
Fixes #42797.

git-svn-id: https://develop.svn.wordpress.org/trunk@42397 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-15 01:01:01 +00:00
Dion Hulse da689558a5 Filesystem: Allow `wp_normalise_path()` to handle PHP stream wrappers such as `php://` correctly.
Props calin, dd32.
Fixes #42837.


git-svn-id: https://develop.svn.wordpress.org/trunk@42387 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-12 04:15:54 +00:00
John Blackbourn a7488c9441 Build/Test tools: Switch to PHPUnit's `expectOutputString()` method instead of manually using output buffers for output assertions.
Props birgire
Fixes #42098


git-svn-id: https://develop.svn.wordpress.org/trunk@42382 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-10 00:30:32 +00:00
John Blackbourn 07be59d34b Build/Test tools: Remove unnecessary PHP functionality tests from the test suite.
Props Frank Klein
Fixes #42277


git-svn-id: https://develop.svn.wordpress.org/trunk@42381 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-09 23:08:24 +00:00
John Blackbourn 61350144fb Role/Capability: When checking capabilities before setting a post slug, ensure the correct post type capabilities are used.
Previously, only the `publish_posts` capability was checked. Now, the correct meta or primitive capability for the post type is used where appropriate.

Props peterwilsoncc

Fixes #42464


git-svn-id: https://develop.svn.wordpress.org/trunk@42380 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-09 22:50:13 +00:00
John Blackbourn 3a7ff0e2e6 Build/Test tools: Add inline documentation to undocumented methods in the `WP_UnitTestCase` class.
Props Frank Klein

Fixes #42731


git-svn-id: https://develop.svn.wordpress.org/trunk@42379 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-08 21:00:08 +00:00
Boone Gorges 2e5bbe0667 `category_description()` should be taxonomy-agnostic.
This change reinstates the previous de facto behavior of `category_description()`.
See [40979], [42364]. Because `term_description()` no longer passes `$taxonomy` to
`get_term_field()`, the parameter is no longer needed and has been deprecated.

Fixes #42605. See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42368 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:48:24 +00:00
Boone Gorges ffb86c0552 `get_the_category_by_ID()` should be taxonomy-agnostic.
Prior to 4.9, this function was accidentally taxonomy-agnostic in most cases.
The fix in [40979] caused a regression in this function. For backward
compatibility, we make it explicit that the query is by ID only.

See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42367 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 21:02:10 +00:00
Boone Gorges 8951af66d4 Fix regression in `get_tag_link()` since 4.9.
See [42364] for description of the problem.

Because `get_category_link()` is now totally taxonomy-agnostic, `get_tag_link()`
can become a simple wrapper.

Props juiiee8487, markjaquith.
See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42366 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:51:27 +00:00
Boone Gorges 829d8bb179 Fix incorrect test names from [42364].
See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42365 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:46:56 +00:00
Boone Gorges e9d828ce41 Don't do a strict taxonomy check in `get_category_link()`.
Prior to version 4.9, a quirk in the implementation of `get_term()` caused
`get_category_link( 123 )` to fetch the taxonomy archive link for term 123
even if 123 is not in the 'category' taxonomy. The quirk was fixed in [40979];
see #40671. This bugfix introduced a regression for theme authors who were
expecting the old behavior.

By lifting the 'category' restriction, we allow the template function to work
in the old way.

Fixes #42717. See #42771.

git-svn-id: https://develop.svn.wordpress.org/trunk@42364 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:38:57 +00:00
Konstantin Obenland 6cb2a02695 Widgets: Don't try mapping empty sidebars.
Fixes a bug where the mapping logic would try mapping empty sidebars, resulting in PHP warnings.

Props ionvv, chetan200891 for initial patch.
Fixes #42603.



git-svn-id: https://develop.svn.wordpress.org/trunk@42362 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-04 20:11:11 +00:00
Joe Hoyle d989b8e402 REST API: Include permalink_structure in the settings route.
There are situations where the REST API client wants to be able to read and set the permalink_structure option. Though this doesn’t fix the use case of front-end rendered unauthenticated websites, it still has utility as a setting in it’s own right.

Props aduth.
See #41014.


git-svn-id: https://develop.svn.wordpress.org/trunk@42359 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 22:28:33 +00:00
Rachel Baker 59c31d2d74 REST API: Correct HTTP status code in error for requests to create a duplicate term.
The 409 error code is intended for situations where it is expected that the user will resolve the conflict and resubmit the same request. We use 400 error codes for other routes when a duplicate request is made. The 400 status code tells the user they need to modify their request for it to be successful.

Props shooper.
Fixes #42781. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42354 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 19:08:23 +00:00
Rachel Baker 2b079e098a REST API: Add existing term_id to the error data object when attempting to create a duplicate term.
Props shooper, coleh.
Fixes #42597. See #41370.

git-svn-id: https://develop.svn.wordpress.org/trunk@42350 602fd350-edb4-49c9-b593-d223f7449a82
2017-12-03 18:10:05 +00:00
Gary Pendergast 8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00