Commit Graph

1751 Commits

Author SHA1 Message Date
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
Pascal Birchler 0e13a57288 Script Loader: Introduce `wp_add_inline_script()`.
This new function can be used to add inline JavaScript before and after enqueued scripts, just like `wp_add_inline_style()` works for CSS.

Props atimmer, abiralneupane, ocean90, swissspidy.
Fixes #14853.

git-svn-id: https://develop.svn.wordpress.org/trunk@36633 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:43:41 +00:00
Boone Gorges 0338c8b3a3 Query: Allow a seed value to be passed when using 'rand' `$orderby`.
`WP_Query` allows random ordering; `'orderby' => 'rand'` translates to
`ORDER BY RAND()`. This syntax results in random ordering that is not
consistent from request to request. MySQL supports the passing of a seed value
to random sorts, such as `ORDER BY RAND(3)`, which will return the same
random value each time it's called. `WP_Query` now supports this syntax, by
passing `RAND(3)` (or whatever integer seed value you'd like) as the value
of `'orderby'`.

Props hlashbrooke.
Fixes #35692.

git-svn-id: https://develop.svn.wordpress.org/trunk@36632 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:39:50 +00:00
Dominik Schilling (ocean90) 7b1c4151dd L10n: Add test for `wp_dropdown_languages()`.
Props realloc.
Fixes #35294.

git-svn-id: https://develop.svn.wordpress.org/trunk@36631 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 16:27:36 +00:00
Ella Iseulde Van Dorpe 7040b4d932 TinyMCE: inline text patterns
First run.

See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@36627 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 08:32:34 +00:00
Boone Gorges 0809037f61 Query: `is_*( $int )` should not falsely match strings starting with "$int".
Another chapter in the Storied Annals of Weird `in_array()` Behavior:
`in_array( 4, array( "4-cool-dudes" ) );` resolves to `true`, such that
`is_page( 4 )` was returning true for posts with the name `'4-cool-dudes'`.

We work around this behavior by ensuring that values passed to the `is_`
methods are cast to strings before the `in_array()` checks. ID checks still
work as expected; see #24674.

Props mikejolley, swissspidy, boonebgorges.
Fixes #35902.

git-svn-id: https://develop.svn.wordpress.org/trunk@36625 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 02:20:28 +00:00
Weston Ruter d14b188c42 Customize: Prevent dropping backslashes from input on general settings and settings for nav menus and some widgets.
Ensures that intentional backslashes (e.g. "\o/") can be used in:

* Site title
* Site description
* Nav menu name
* Custom Menu widget title
* Tag Cloud widget title
* Text widget body if can't `unfiltered_html`

The latter three are also fixed on the widgets admin page.

Fixes #35898.


git-svn-id: https://develop.svn.wordpress.org/trunk@36622 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-23 01:01:43 +00:00
Dominik Schilling (ocean90) 12cf07c669 Authentication: Allow users to log in using their email address.
Introduces `wp_authenticate_email_password()` which is hooked into `authenticate` after `wp_authenticate_username_password()`.

Props Denis-de-Bernardy, ericlewis, vhomenko, MikeHansenMe, swissspidy, ocean90.
Fixes #9568.

git-svn-id: https://develop.svn.wordpress.org/trunk@36617 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 23:14:27 +00:00
Mike Schroder cde3d4c399 Media: Update unit tests after change to default image quality.
Updates unit tests to reflect new default quality setting of '82' after [36615].

See #33642.

git-svn-id: https://develop.svn.wordpress.org/trunk@36616 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 23:13:27 +00:00
Boone Gorges 408fb37f2b Allow `get_terms()` to fetch terms regardless of taxonomy.
`get_terms()` has historically required that a taxonomy be specified when
querying terms. This requirement is related to the fact that terms could
formerly be shared between taxonomies, making `$taxonomies` critical for
disambiguation. Since terms can no longer be shared as of 4.4, it'
s desirable to be able to query for terms regardless of what taxonomy they're in.

Because it's now optional to pass taxonomies, it's no longer necessary to have
`$taxonomies` as the first (and required) parameter for `get_terms()`. The new
function signature is `get_terms( $args )`, where 'taxonomy' can (optionally) be
passed as part of the `$args` array. This syntax is more consistent with
functions like `get_users()` and `get_posts()`.

We've maintained backward compatibility by always giving precedence to the old
argument format. If a second parameter is detected, or if it's detected that
the first parameter is a list of taxonomy names rather than an `$args` array,
`get_terms()` will parse the function arguments in the legacy fashion.

Props flixos90, swissspidy, DrewAPicture, boonebgorges.
Fixes #35495.

git-svn-id: https://develop.svn.wordpress.org/trunk@36614 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 22:16:37 +00:00
Weston Ruter 56598b5f90 Customize: Prevent PHP notice and JS error caused by widgets and nav menus components if user only has `customize` capability.
Short-circuits components from initializing their hooks needlessly if current user lacks required capability.

Fixes #35895.


git-svn-id: https://develop.svn.wordpress.org/trunk@36611 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 05:30:30 +00:00
Weston Ruter bd09cddfc1 Customize: Update unit test for `WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item()` to account for slashing if user can't `unfiltered_html`.
Fixes unit tests which broke under multisite config after [36608].

Fixes #35869.


git-svn-id: https://develop.svn.wordpress.org/trunk@36610 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 05:09:34 +00:00
Weston Ruter d06329d035 Customize: Fix previewing and updating of nav menu items containing slashed/slashable characters.
Prevents slashes from being added when a user without `unfiltered_html` previews a nav menu item containing an apostrophe or some other slashable character, and prevents the loss of an intentional slash (e.g. "\o/") when saving a nav menu item, regardless of capability.

Fixes #35869.


git-svn-id: https://develop.svn.wordpress.org/trunk@36608 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-22 00:13:53 +00:00
Eric Andrew Lewis c592a7262e Posts: Non-trashed posts should take slug priority over trashed posts.
When determining a unique post slug, trashed posts are taken into account. Previously, new posts would add suffixes to their slugs (e.g. `about-2`) when a post in the trash had the desired slug (e.g. `about`). 

To avoid this behavior, when a post is trashed its slug (i.e. `post_name`) is now suffixed with `-%trashed%`. The post's pre-trash slug is stored as post meta, and if the post is restored from trash, its desired slug is reapplied. 

For existing trashed posts which don't have the `-%trashed%` suffix, the suffix is added when a post with its desired slug is created.

Props ocean90, boonebgorges, ryan, SergeyBiryukov, coffee2code, helen, williamsba1.
See #11863.


git-svn-id: https://develop.svn.wordpress.org/trunk@36607 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-21 21:44:14 +00:00
Dominik Schilling (ocean90) 6e493b1713 Script Loader: Fix missing script output when the groups of dependencies are different.
Aka: Don't lose the grandchild.

Props gitlost, ocean90.
Fixes #35873.

git-svn-id: https://develop.svn.wordpress.org/trunk@36604 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 22:10:01 +00:00
Dominik Schilling (ocean90) 5f9d1fa799 Tests: Test that jQuery can be moved into footer after [36550].
Props gitlost.
See #25247.

git-svn-id: https://develop.svn.wordpress.org/trunk@36596 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 16:16:35 +00:00
Boone Gorges c43fc5ac2b Tests: Add decorators to PHPMailer mock object.
The new `get_recipient()` and `get_sent()` methods greatly simplify the
syntax required when writing tests for `wp_mail()`.

Props welcher.
Fixes #34161.

git-svn-id: https://develop.svn.wordpress.org/trunk@36594 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-20 03:40:49 +00:00
Andrew Ozz 218c1240b8 TinyMCE: update to 4.3.4. Changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt.
Fixes #35876.

git-svn-id: https://develop.svn.wordpress.org/trunk@36589 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-19 19:18:59 +00:00
Weston Ruter 03360d143d Customize: Add selective refresh framework with implementation for widgets and re-implementation for nav menus.
See https://make.wordpress.org/core/2016/02/16/selective-refresh-in-the-customizer/.

Props westonruter, valendesigns, DrewAPicture, ocean90.
Fixes #27355.


git-svn-id: https://develop.svn.wordpress.org/trunk@36586 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-19 18:40:06 +00:00
Dominik Schilling (ocean90) 2d7150e40d Formatting: Avoid a PHP warning when `wptexturize()` is called with a trailing less-than symbol.
Props westonruter.
Fixes #35864.

git-svn-id: https://develop.svn.wordpress.org/trunk@36578 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-18 20:30:54 +00:00
Dominik Schilling (ocean90) 9f5eb3c604 Add missing test changes for [36573].
See #34755.

git-svn-id: https://develop.svn.wordpress.org/trunk@36574 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-18 17:43:56 +00:00
Boone Gorges 0e9ff07da5 Reintroduce term meta unit test accidentally removed in [36566].
git-svn-id: https://develop.svn.wordpress.org/trunk@36567 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 23:01:05 +00:00
Boone Gorges 28fad09b61 More performance improvements to metadata lazyloading.
Comment and term meta lazyloading for `WP_Query` loops, introduced in 4.4,
depended on filter callback methods belonging to `WP_Query` objects. This meant
storing `WP_Query` objects in the `$wp_filter` global (via `add_filter()`),
requiring that PHP retain the objects in memory, even when the local variables
would typically be expunged during normal garbage collection. In cases where a
large number of `WP_Query` objects were instantiated on a single pageload,
and/or where the contents of the `WP_Query` objects were quite large, serious
performance issues could result.

We skirt this problem by moving metadata lazyloading out of `WP_Query`. The
new `WP_Metadata_Lazyloader` class acts as a lazyload queue. Query instances
register items whose metadata should be lazyloaded - such as post terms, or
comments - and a `WP_Metadata_Lazyloader` method will intercept comment and
term meta requests to perform the cache priming. Since `WP_Metadata_Lazyloader`
instances are far smaller than `WP_Query` (containing only object IDs), and
clean up after themselves far better than the previous `WP_Query` methods (bp
only running their callbacks a single time for a given set of queued objects),
the resource use is decreased dramatically.

See [36525] for an earlier step in this direction.

Props lpawlik, stevegrunwell, boonebgorges.
Fixes #35816.

git-svn-id: https://develop.svn.wordpress.org/trunk@36566 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:57:33 +00:00
Andrew Ozz c7936b8785 Improve the performance of `wp_upload_dir()`:
- Cache the output in non-persistent cache.
- Cache the result from `wp_mkdir_p()` in persistent cache (when present).
- Introduce `wp_get_upload_dir()` for use when not uploading files. It is equivalent to `wp_upload_dir()` but does not check for the existence or create the upload directory.
- Change tests to use the non-cached `_wp_upload_dir()`. They change options on the fly (should never be used in production) to simulate different environments.
- Introduce `_upload_dir_no_subdir()` and `_upload_dir_https()` to facilitate testing. These use the proper `upload_dir` filter to simulate different environments.

Props kovshenin, azaozz.
See #34359.

git-svn-id: https://develop.svn.wordpress.org/trunk@36565 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:51:01 +00:00
Dominik Schilling (ocean90) bc95fd2884 Tests: Add test for `wp_get_installed_translations()`.
Introduces language files in /tests/phpunit/data/language. Each file includes the header and 5 translations.

Props realloc for initial patch.
Fixes #35284.

git-svn-id: https://develop.svn.wordpress.org/trunk@36563 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 22:01:11 +00:00
Dominik Schilling (ocean90) 548a18059c Tests: Add a test for testing `wp_enqueue_script()` with an alias handle in the footer.
Props kovshenin.
See #35643.

git-svn-id: https://develop.svn.wordpress.org/trunk@36559 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 19:52:42 +00:00
Dominik Schilling (ocean90) 653e0b0827 Tests: Add `Tests_dbDelta::assertTableHasPrimaryKey()`.
Also fix a typo in the name for the compound key.

Props charlestonsw.
Fixes #34877.

git-svn-id: https://develop.svn.wordpress.org/trunk@36552 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 18:54:27 +00:00
Dominik Schilling (ocean90) 59747aa6b9 Script/Style Dependencies: Make sure that inline styles for handles without a source are printed.
This prevents breaking plugins which are adding inline styles to the `wp-admin` handle after [36341].

Props dd32, ocean90.
Fixes #35229.

git-svn-id: https://develop.svn.wordpress.org/trunk@36550 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 17:10:53 +00:00
Dominik Schilling (ocean90) 149686b424 Tests: Indent `test_wp_register_script()` with tabs.
git-svn-id: https://develop.svn.wordpress.org/trunk@36549 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 16:07:01 +00:00
Dominik Schilling (ocean90) de9d091e76 Tests: Indent `test_wp_register_style()` with tabs.
git-svn-id: https://develop.svn.wordpress.org/trunk@36547 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-17 15:36:20 +00:00
Dominik Schilling (ocean90) 35579fa786 i18n: Prevent `is_textdomain_loaded()` from returning true even if there are no translations for the domain.
In `get_translations_for_domain()` don't fill the global `$l10n` with `NOOP_Translations` instances, return a `NOOP_Translations` instance instead.

Props nacin, jrf.
Fixes #21319.

git-svn-id: https://develop.svn.wordpress.org/trunk@36538 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 21:14:45 +00:00
Ryan McCue 10bfe70f06 REST API: Allow explicit HEAD callbacks.
HEAD callbacks can now be registered independently, with the GET
callback still used as a fallback.

Fixes #34841.


git-svn-id: https://develop.svn.wordpress.org/trunk@36535 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 05:50:21 +00:00
Ryan McCue d7e7c0b81b REST API: Add support for CURIEs.
CURIEs are Compact URIs, which provide a more usable way to use
custom relations in the API. The `wp` CURIE is registered by default
for `https://api.w.org/` URI relations.

Fixes #34729.
Props joehoyle.


git-svn-id: https://develop.svn.wordpress.org/trunk@36533 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 02:18:34 +00:00
Weston Ruter 6dd1dd61a1 Customize: Add a user-friendly way to preview site responsiveness for desktop, tablet, and mobile.
Introduces `WP_Customize_Manager::get_previewable_devices()` with a `customize_previewable_devices` filter to change the default device and which devices are available for previewing. This is a feature that was first pioneered on WordPress.com.

Props celloexpressions, folletto, valendesigns, westonruter, welcher, adamsilverstein, michaelarestad, Fab1en.
Fixes #31195.


git-svn-id: https://develop.svn.wordpress.org/trunk@36532 602fd350-edb4-49c9-b593-d223f7449a82
2016-02-16 01:56:13 +00:00