Commit Graph

1831 Commits

Author SHA1 Message Date
Boone Gorges 23b3f3e2ee Add tests for `is_serialized_string()`.
Props borgesbruno.
Fixes #35952.

git-svn-id: https://develop.svn.wordpress.org/trunk@37357 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-04 03:29:47 +00:00
Weston Ruter 0321612c4d Customize: Handle filtering `sidebars_widgets` when the underlying option is non-existent.
Fixes warning related to a non-array argument for `array_merge()` in `WP_Customize_Widgets::customize_register()`. 

See [37166].
See #36389.
Fixes #36660.


git-svn-id: https://develop.svn.wordpress.org/trunk@37352 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 23:41:18 +00:00
Weston Ruter 018f988654 Customize: Pass `WP_Customize_Setting` instance as second argument to `customize_value_{$id_base}` filter.
Adds parity with setting instance being passed as second argument to `customize_sanitize_{$id}` and `customize_sanitize_js_{$id}`. Allows the actual ID of the (multidimensional) setting value being filtered to be inspected.

Props celloexpressions, westonruter.
Fixes #36452.


git-svn-id: https://develop.svn.wordpress.org/trunk@37350 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 22:41:36 +00:00
Drew Jaynes 0f468dd456 Comments: Adjust `comment_author_email_link()` and `get_comment_author_email_link()` to each accept a new optional fourth parameter, `$comment`, which enables overriding the `$comment` global.
Adds tests.

Props flixos90, boonebgorges, DrewAPicture.
See #36571.


git-svn-id: https://develop.svn.wordpress.org/trunk@37348 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 19:58:23 +00:00
Eric Andrew Lewis 32ed4fadf2 Posts: Allow `get_page_uri()` to be called without a $page argument.
`get_page_uri()` can now be called without an argument, which will return the page URI for the current post in the loop.

Props pollett.
Fixes #26284.


git-svn-id: https://develop.svn.wordpress.org/trunk@37345 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 18:28:04 +00:00
Drew Jaynes 0efe87a4fb Tests: Remove debug cruft left over from [34816].
See #17078.


git-svn-id: https://develop.svn.wordpress.org/trunk@37344 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-02 16:23:47 +00:00
Weston Ruter f660ffb601 Widgets: Provide PHP 5.2 fallback for `spl_object_hash()` if disabled in logic for registering and unregistering pre-instantiated widgets.
Fixes #28216.


git-svn-id: https://develop.svn.wordpress.org/trunk@37333 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-30 22:35:27 +00:00
Dominik Schilling (ocean90) d62141c38d Plugins: In `plugin_basename()` normalize the file path before unresolving symlinks.
`$wp_plugin_paths` contains normalized paths, see `wp_register_plugin_realpath()`.

Props jdgrimes, voldemortensen, flyingdr, ocean90.
Fixes #29154.

git-svn-id: https://develop.svn.wordpress.org/trunk@37332 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-30 15:08:06 +00:00
Weston Ruter 7ad11aaad8 Widgets: Allow `WP_Widget` subclass instances (objects) to be registered/unregistered in addition to `WP_Widget` subclass names (strings).
Allows widgets to be registered which rely on dependency injection. Also will allow for new widget types to be created dynamically (e.g. a Recent Posts widget for each registered post type).

See #35990.
Props mdwheele, PeterRKnight, westonruter.
Fixes #28216.


git-svn-id: https://develop.svn.wordpress.org/trunk@37329 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 18:48:27 +00:00
Scott Taylor ec0614cf17 Media/Unit Tests: ensure that image sizes are indeed removed when errors are raised before assertions in `Tests_Media`.
See #36588.


git-svn-id: https://develop.svn.wordpress.org/trunk@37328 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 17:51:54 +00:00
Scott Taylor fe85e78329 Media/Unit Tests: ensure that the GD absrtraction is used for GD unit tests for Images. Some of the procedural GD API functions can still throw `ImagickException`, which is fun.
See #36588.


git-svn-id: https://develop.svn.wordpress.org/trunk@37327 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 16:15:37 +00:00
Boone Gorges 00c39a3f98 Query: Discard non-scalar 'm' instead of attempting to sanitize.
`WP_Query` discards most non-array date values ('year', 'monthnum', etc) by
casting to integer. Since [25138], the 'm' parameter has been handled
as a string; see #24884. However, the string-handling introduced in [25138]
blindly attempted to handle arrays and other non-scalar types as strings,
resulting in PHP notices and invalid MySQL syntax.

Props vortfu.
Fixes #36718.

git-svn-id: https://develop.svn.wordpress.org/trunk@37324 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-29 13:14:18 +00:00
Eric Andrew Lewis 878343d4d1 Database: Set MySQL connection collation.
Fixes #36649.


git-svn-id: https://develop.svn.wordpress.org/trunk@37320 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-28 01:38:31 +00:00
Eric Andrew Lewis 8692cdbecd Build/Test Tools: Document `WP_UnitTestCase->go_to()`
Fixes #36679.


git-svn-id: https://develop.svn.wordpress.org/trunk@37319 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 18:24:34 +00:00
Jeremy Felt 967eb06e1b Tests: Reduce unnecessary count in `create_many()` in multisite user tests
The tests for `is_blog_user()` and `is_user_member_of_blog()` should be refactored. Until then, we can shave several seconds from the test time by avoiding unnecessary loops of the same tests.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37318 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 06:32:47 +00:00
Jeremy Felt 534f0e92a0 Users: Provide a full user object when checking for a spammy multisite user
`is_user_spammy()` falls back to the current user if one is not provided. There is no current user during authentication, so the result is always `false`. Pass a user to fill the void.

Adds tests for `wp_authenticate_spam_check()`.

Props websupporter.
Fixes #36546.


git-svn-id: https://develop.svn.wordpress.org/trunk@37316 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-27 05:35:37 +00:00
Rachel Baker 1bee2ff07a Post Thumbnails: Fix logic bug and tests from [37308] where post-thumbnails support wasn’t added if there were no previous post_types with support already.
See #22080

git-svn-id: https://develop.svn.wordpress.org/trunk@37313 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 20:28:46 +00:00
Rachel Baker 3518df091f Tests: Fix typo `current_theme_support()` -> `current_theme_supports()` from [37308]
git-svn-id: https://develop.svn.wordpress.org/trunk@37309 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 17:30:19 +00:00
Rachel Baker 2ff19ab7d3 Post Thumbnails: When using `add_theme_support( ‘post-thumbnails’, array( $post_types) )` merge the supported post_types.
Allow the adding of post-thumbnail support for one or more post_types without unsetting any previously added post_types. This matches the behavior of other uses of `add_theme_support()` and the expectations of a function with a prefix of “add”.
To unset post-thumbnail support use `remove_theme_support()` instead.

Fixes #22080

Props alexkingorg, jmichaelward, and flixos90.

git-svn-id: https://develop.svn.wordpress.org/trunk@37308 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-26 17:04:25 +00:00
Sergey Biryukov 274902b03a Build/Test Tools: Reset the PHPMailer mock in `Tests_Mail::tearDown()`.
Props welcher.
Fixes #36609.

git-svn-id: https://develop.svn.wordpress.org/trunk@37307 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-23 08:15:11 +00:00
Scott Taylor aba30dc390 Unit Tests: prevent rewrite spillage from `@group author` unit tests.
See #36587.


git-svn-id: https://develop.svn.wordpress.org/trunk@37306 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 23:47:27 +00:00
Scott Taylor a776b0b6df Comments: add a `$comment` parameter to `get_comment_author_url_link()`.
Add unit tests (none exist).

Props flixos90, wonderboymusic.
Fixes #36573.


git-svn-id: https://develop.svn.wordpress.org/trunk@37305 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 22:44:33 +00:00
Jeremy Felt 5af20a3de3 Tests: Account for flexible IDs in main network deletion test
After [37299], the network IDs encountered by this test may be larger than "100".

This adjusts the test to respond accordingly until we have a better way to delete networks.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37300 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 15:21:14 +00:00
Boone Gorges 7c79386135 Tests: Use the same incrementor for all fields belonging to a given text fixture.
[35244] changed the way that `WP_UnitTest_Generator_Sequence()` created an
incrementor for object fields (like 'post_name' and 'user_email'), by making
incrementor static across the entire run of the test suite. While this helped
to enforce uniqueness across the tests, it has the side effect of bumping the
incrementor between fields on the same object (so that, eg, the same post might
have `post_name` "post-12" but `post_title` "Post 13". By switching to a
technique that uses the same incrementor for each field belonging to a given
fixture, we conform better to the expectations of developers using
`WP_UnitTest_Factory`.

Fixes #35199.

git-svn-id: https://develop.svn.wordpress.org/trunk@37299 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 14:35:52 +00:00
Gary Pendergast f9e1cf5de0 Smilies: Move `convert_smilies` to happen later in the `the_content` filter.
In particular, we want it to occur after shortcode handling. The smiley conversion routine doesn't have any concept of shortcode structure, so may inadvertantly replace a smiley with HTML inside a shortcode attribute, which will cause the shortcode to not be parsed correctly.

Props Unyson for the initial suggested fix.

Fixes #36306. 



git-svn-id: https://develop.svn.wordpress.org/trunk@37298 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 07:07:03 +00:00
Gary Pendergast 74e88010c0 Emoji: The `:roll:` smiley is now an emoji.
Unicode 8 added `U+1F644`, "Face with Rolling Eyes", which matches our `:roll:` smiley. Continuing our ever present quest to rid the world of legacy smilies, we now translate that smiley into its emoji form.

Sadly, `:mrgreen:` remains sorely under-represented in the Unicode standard, I'm inclined to think that we should buy a voting membership of the Unicode Consortium, in order to rectify that situation. (Personally, I'm hoping for a green skin tone modifier.)

Fixes #36365.
 



git-svn-id: https://develop.svn.wordpress.org/trunk@37296 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 06:28:51 +00:00
Dominik Schilling (ocean90) 153610292d Media: Remove an extra quote when sending a link of a media file to the editor.
Introduced in [37035].

Props joemcgill, swissspidy, boonebgorges.
Fixes #36578.

git-svn-id: https://develop.svn.wordpress.org/trunk@37288 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 21:20:26 +00:00
Boone Gorges ce350d5d5d Tests: More explicit fixture content when testing `s=0` query string.
After [36647], the unit test generator sequence can put a 0 into the
'post_excerpt' field of a post fixture, causing false positives.

See [36520] for a parallel fix involving 'post_content'.

Fixes #36622.

git-svn-id: https://develop.svn.wordpress.org/trunk@37280 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 15:52:33 +00:00
Sergey Biryukov d5e795ca9e Users: Add a unit test for [37276].
See #36009.

git-svn-id: https://develop.svn.wordpress.org/trunk@37277 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 11:51:59 +00:00
Drew Jaynes 6c4c867b89 Tests: Pre-declare the `$year_url` property before initialization in `Tests_Get_Archives::setUp()`.
Props pbearne.
Fixes #36611.


git-svn-id: https://develop.svn.wordpress.org/trunk@37271 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-21 02:55:52 +00:00
Jeremy Felt 67e6dc1c43 Tests: Add speedTrapListener to multisite's PHPUnit config
See #36566, #30017.


git-svn-id: https://develop.svn.wordpress.org/trunk@37267 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 17:01:07 +00:00
Jeremy Felt f692459926 Tests: Allow override of `MULTISITE` and `SUBDOMAIN_INSTALL` constants
Props rmccue.
Fixes #36567.


git-svn-id: https://develop.svn.wordpress.org/trunk@37266 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 16:51:58 +00:00
Boone Gorges 01ef43ace7 Tests: After [37260], use WP's `setUpBeforeClass()` wrappers.
This ensures no leakage between tests of fixture IDs.

See #36602.

git-svn-id: https://develop.svn.wordpress.org/trunk@37261 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 15:30:40 +00:00
Boone Gorges ddd88a79b1 Add tests for permastruct containing `/%category%/`.
See #36602.

git-svn-id: https://develop.svn.wordpress.org/trunk@37260 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-20 14:59:02 +00:00
Dominik Schilling (ocean90) 4bd7394a2e Themes: Revert [36112]
Adding the `singular` class per default to the list of body classes is breaking the layout of Twenty Eleven and other themes. Twenty Eleven adds the `.singular` class only to single pages if the page doesn't use specific page templates.

Props flixos90, swissspidy.
Fixes #36510.

git-svn-id: https://develop.svn.wordpress.org/trunk@37249 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-19 21:23:20 +00:00
Jeremy Felt d72c2197ed Tests: Add test for multiple site path segments in bootstrap
This fixes a `@todo` that has been around since the introduction of these tests in [28910].

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37241 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:38:11 +00:00
Jeremy Felt fa92abf4f3 Tests: Add missing params to doc blocks
* These should have been included in [37236] and [37238].
* Simplifies parameter names in `test_get_network_by_path()`

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37239 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:26:48 +00:00
Jeremy Felt bf5abfd9d0 Tests: Use a data provider to test multisite's bootstrap
This also helps to get things in order before the introduction of a more testable multisite bootstrap function in #34941.

A `@todo` has been temporarily removed, to be re-introduced as a working test.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37238 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 03:18:51 +00:00
Jeremy Felt 5e2f936c28 Tests: Use a data provider in `get_site_by_path()` tests
See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37237 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 02:38:49 +00:00
Jeremy Felt 48ba391b9b Tests: Use a data provider to test `get_network_by_path()`
See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37236 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 02:00:36 +00:00
Jeremy Felt e4efe5fac9 Tests: Share test fixtures in multisite bootstrap tests
* Remove unnecessary `setUp` and `tearDown` methods.
* Create networks and sites in `wpSetupBeforeClass` to share throughout.
* Destroy networks and sites in `wpTearDownAfterClass` to unpollute.

See #36566, #34941.


git-svn-id: https://develop.svn.wordpress.org/trunk@37234 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 01:37:47 +00:00
Jeremy Felt 89877c5941 Tests: Improve `get_blog_count()` tests
* Use `wp_update_network_counts()` to update the database with the most current data before testing.
* Use `wp_update_network_counts()` to update the database with the most current data after deleting the sites created during the test.
* Create only 1 extra site in each test rather than 4. This shaves several seconds off the test time.
* Stop testing for an extra count now that we update the network counts properly. Previously we looked at `$site_count_start + 9` rather than 8. Now this is `+ 1`, which aligns with the actual number of sites created.
* Test 3 explicit conditions - default, filter applied as `true`, and filter applied as `false`.
* Reset data before testing assertion to avoid a suspended state.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37233 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-18 01:28:56 +00:00
Boone Gorges 8ee26e699f Query: Allow results to be ordered by `post_parent__in`.
Props postpostmodern.
Fixes #36515.

git-svn-id: https://develop.svn.wordpress.org/trunk@37225 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-17 03:16:36 +00:00
Boone Gorges d73ec171c0 Tests: Improvements to /post/query test class.
* Add `@group` annotation.
* Remove unnecessary `setUp()` method.

git-svn-id: https://develop.svn.wordpress.org/trunk@37224 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-17 03:12:39 +00:00
Jeremy Felt 426f5256fb Options: Do not set network options to autoload in single site
When multisite is not configured, the `_site_transient()` and `_site_option()` functions fallback to `_option()` and store network "meta/options" in `wp_options`.

Previously, those calls to `_option()` did not explicitly set the `autoload` parameter and anything assigned as a transient or option at the network level would be set to `autoload` by default, even though autoload is not yet a concept at the network option level.

This changes that behavior and forces the `autoload` setting to `no`. If `autoload` is desired, the single site option functions should be used.

Props thomaswm.
Fixes #22846.


git-svn-id: https://develop.svn.wordpress.org/trunk@37223 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-16 19:47:14 +00:00
Jeremy Felt 83d80f7329 Tests: Run network option tests as single and multisite
The `_network_option()` functions are available to all and
internally use `_option()` functions as a fallback. We should
be testing for that scenario as well.

Fixes #36552.


git-svn-id: https://develop.svn.wordpress.org/trunk@37222 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-16 19:21:49 +00:00
Jeremy Felt a56fc1fba0 Multisite: Introduce `WP_Theme` methods to network enable/disable themes.
* `WP_Theme::network_enable_theme()` can be used to enable a theme or array of themes on a network.
* `WP_Theme::network_disable_theme()` can be used to disable a theme or array of themes on a network.
* Use these new methods in the network admin vs direct `update_site_option()` calls.
* Add tests.

Props igmoweb.
Fixes #30594.


git-svn-id: https://develop.svn.wordpress.org/trunk@37202 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-14 03:39:45 +00:00
Sergey Biryukov c39ba1cdd9 Docs: Reference the correct variable in `WP_Ajax_UnitTestCase::_handleAjax()` documentation.
Props meitar.
Fixes #36522.

git-svn-id: https://develop.svn.wordpress.org/trunk@37199 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-14 02:28:03 +00:00
Boone Gorges 26a5e78d94 Improve testability and coverage of `wp_ext2type()`.
* Following pattern of `wp_get_mime_types()`, introduce `wp_get_ext_types()` function. New function returns a filtered list of file types with their extensions.
* Use this function in new tests for `wp_ext2type()`.

Props borgesbruno.
Fixes #35987.

git-svn-id: https://develop.svn.wordpress.org/trunk@37189 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-13 03:11:25 +00:00
Boone Gorges 765e23a4a6 Use `LEFT JOIN` when building `WP_Tax_Query` SQL.
`LEFT JOIN` ensures that `NOT EXISTS` queries will not miss posts that have
no taxonomy data whatsoever.

Props swissspidy, crstauf.
Fixes #36343.

git-svn-id: https://develop.svn.wordpress.org/trunk@37184 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-12 20:36:31 +00:00
Jeremy Felt f98744ec86 Ensure consistent dependency order when using `wp_add_inline_script()`
This disables the concatenation of remaining enqueued scripts once `wp_add_inline_script()` is invoked, which allows us to reliably print these scripts and their before/after inline scripts in the desired order.

Props gitlost, azaozz, swisspidy, ocean90.
Fixes #36392.


git-svn-id: https://develop.svn.wordpress.org/trunk@37171 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-10 03:32:47 +00:00
Dominik Schilling (ocean90) ca5db69c31 Customize: Harden assignment of Customizer settings transports for selective refreshable widgets
Theme support for `customize-selective-refresh-widgets` can be added _after_ the logic for registering the settings for incoming widgets that have been changed. This is due to themes adding the theme support in `after_setup_theme` which is also the action where `WP_Customize_Widgets::register_settings()` is called. If these both happen at priority 10, which one is called first depends on which one was added first. The other issue is that at the time that `WP_Customize_Widgets::register_settings()` is called at `after_setup_theme`, it is called before `widgets_init` and thus no widgets are yet registered. This means that any settings registered at this point will always have a `refresh` transport even if the theme supports `customize-selective-refresh-widgets`, since the `WP_Widget` instance is not visible yet to see if it supports selective refresh.

The fix: Defer `WP_Customize_Widgets::register_settings()` from `after_setup_theme` to `widgets_init` at priority 95 when the widget objects have all been registered. Also, ensure that the preview filter for `sidebars_widgets` is added before the sidebars are iterated for adding the controls.

Props westonruter.
Fixes #36389.

git-svn-id: https://develop.svn.wordpress.org/trunk@37166 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-07 20:58:56 +00:00
boonebgorges f1c3ec9010 Use `__trashed` suffix rather than `-%trashed%` for trashed post slugs.
Percent signs are reserved characters in URIs. As such, it was impossible for
plugins to route requests to trashed posts, as happens in bbPress. The new
`__trashed` suffix should be sufficiently unique.

Also adds a test that demonstrates that the `__trashed` suffix can be
appended to slugs that contain the suffix somewhere other than the end of
the string.

Props netweb, ericlewis.
Fixes #11863.

git-svn-id: https://develop.svn.wordpress.org/trunk@37165 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-07 19:21:02 +00:00
Mark Jaquith 9deec9e723 REST API: Deliver parameters unadulterated instead of slashed.
We goofed, and parameters accessed through the REST API's methods
were slashed (inconsistently, even). This unslashes the data, so
you get the un-messed-with data that was sent.

Props joehoyle.
Fixes #36419.

git-svn-id: https://develop.svn.wordpress.org/trunk@37163 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-06 21:01:11 +00:00
John Blackbourn 6c79b715bd Role/Capability: Add `create_sites` and `delete_sites` to the list of capabilities that are checked as part of the comporehensive roles and capabilities tests.
See #32394, #36413


git-svn-id: https://develop.svn.wordpress.org/trunk@37157 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-04 22:29:55 +00:00
Aaron Jorbin 253308253b Adjust unit tests to account for change in [37144]
git-svn-id: https://develop.svn.wordpress.org/trunk@37150 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-30 19:52:14 +00:00
Konstantin Obenland ef53a0db39 Template: Remove `$size` reference from `get_custom_logo()`.
Argument was removed in [37077] in favor of `with` and `height` arguments.

Props ocean90.
Fixes #36327.



git-svn-id: https://develop.svn.wordpress.org/trunk@37135 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-30 17:19:41 +00:00
Ella Iseulde Van Dorpe 859d40bd24 Editor: wptextpattern: add back inline tests
See [37024].
See #33300.


git-svn-id: https://develop.svn.wordpress.org/trunk@37080 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-25 13:30:10 +00:00
Sergey Biryukov 0058968499 Canonical / Query: Restore the `is_404()` check in `wp_old_slug_redirect()` which was removed in [34659].
This reverts part of [34659] due to excessive canonical problems it's caused in 4.4.x.

Remove the unit tests which are no longer supported.
This also removes the `is_feed()` code to avoid confusion - only pages & embeds will be redirected.

Merges [36280] and [36281] to trunk.

Props dd32.
See #21602, #35344.

git-svn-id: https://develop.svn.wordpress.org/trunk@37075 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-23 21:53:44 +00:00
Boone Gorges 8e317daa37 Tests: Ensure that the default `wp_die()` handler can handle a `WP_Error` object.
Props dd32, utkarshpatel.
Fixes #36166.

git-svn-id: https://develop.svn.wordpress.org/trunk@37071 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-23 19:00:38 +00:00
Dominik Schilling (ocean90) 6c0a66cf49 Users: In `edit_user()` check for a blank password when adding a user.
Props wesleye, gitlost, adamsilverstein.
Fixes #35715.

git-svn-id: https://develop.svn.wordpress.org/trunk@37059 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-22 23:06:29 +00:00
Rachel Baker dab5c5daa7 XMLRPC: Unit tests left off [r37043]
See #35874.

Props redsweater, rachelbaker

git-svn-id: https://develop.svn.wordpress.org/trunk@37044 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-22 15:11:06 +00:00
Weston Ruter 4569f93d3e Customize: Require opt-in for selective refresh of widgets.
* Introduces `customize-selective-refresh-widgets` theme support feature and adds to themes.
* Introduces `customize_selective_refresh` arg for `WP_Widget::$widget_options` and adds to all core widgets.
* Remove `selective_refresh` from being a component that can be removed via `customize_loaded_components` filter.
* Add `WP_Customize_Widgets::get_selective_refreshable_widgets()` and `WP_Customize_Widgets::is_widget_selective_refreshable()`.
* Fix default `selector` for `Partial` instances.
* Implement and improve Masronry sidebar refresh logic in Twenty Thirteen and Twenty Fourteen, including preservation of initial widget position after refresh.
* Re-initialize ME.js when refreshing `Twenty_Fourteen_Ephemera_Widget`.

See #27355.
Fixes #35855.


git-svn-id: https://develop.svn.wordpress.org/trunk@37040 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-21 21:58:02 +00:00
Andrew Ozz 058a2f558d Media: fix erroneously inserting a rel attribute in `get_image_send_to_editor()`. Reverts most of [34259] and [34260] and adds a unit test.
Props joemcgill, azaozz.
Fixes #36084.

git-svn-id: https://develop.svn.wordpress.org/trunk@37035 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-18 20:04:19 +00:00
Andrew Ozz 33947e4ba6 Responsive Images: the `src` of the image has to be first in the `srcset`, because of a bug in iOS8. Update the unit tests to reflect the changes.
Props jaspermdegroot, joemcgill, azaozz.
Fixes #35030.

git-svn-id: https://develop.svn.wordpress.org/trunk@37034 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-18 19:44:50 +00:00
Rachel Baker da45e59bbd REST API: Add `home_url` to API index to avoid confusion with `site_url`.
Confusion abound, the API index is the generic term `url` to display the `site_url`. New `home` key will display the `home_url` in the index as well.

Fixes #35647.

git-svn-id: https://develop.svn.wordpress.org/trunk@37031 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-17 19:15:57 +00:00
Sergey Biryukov 57646fb7ba TinyMCE: Adjust textpattern tests for the changes in [37023].
See #33300.

git-svn-id: https://develop.svn.wordpress.org/trunk@37024 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-17 00:46:26 +00:00
John Blackbourn f1af2813d3 Media: When generating the base URL to be used in the `srcset` attribute, use an `https` scheme when the image base URL's host matches that of the current host, and the request is being served over HTTPS. This prevents mixed content warnings caused by `http` embedded media.
See #34945
Props joemcgill


git-svn-id: https://develop.svn.wordpress.org/trunk@37022 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 22:48:13 +00:00
Dominik Schilling (ocean90) ab8ff0dee1 Responsive images: Skip images with a missing `$image_meta['file']` value.
Props joemcgill.
See [37002].
Fixes #35480.

git-svn-id: https://develop.svn.wordpress.org/trunk@37018 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 17:47:41 +00:00
Andrew Ozz 1046806376 Responsive images: do not attempt to create srcset when the image meta is missing or corrupted.
Props overclokk, jaspermdegroot, joemcgill.
Fixes #35480.

git-svn-id: https://develop.svn.wordpress.org/trunk@37002 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-16 02:17:19 +00:00
Andrew Ozz 22e01b6274 TinyMCE: update to 4.3.8, changelog: https://www.tinymce.com/docs/changelog/#version438-march152016.
Fixes #36254.

git-svn-id: https://develop.svn.wordpress.org/trunk@37000 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 21:37:22 +00:00
Mike Schroder eb0268dbe7 Media: Fix typo in `test_image_preserves_alpha_on_rotate()`.
peserves -> preserves; introduced in [31040].

See #30596.

git-svn-id: https://develop.svn.wordpress.org/trunk@36998 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 03:50:40 +00:00
Gary Pendergast 8233227667 WPDB: Reset connection status variables when the connection is closed.
Fixes #36240.



git-svn-id: https://develop.svn.wordpress.org/trunk@36997 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-15 03:27:14 +00:00
Boone Gorges 9f05bf8ed9 Query: Ignore search terms consisting of a single dash.
Due to the "exclude" support added in WP 4.4, single dashes were being
converted to "NOT LIKE '%%'" clauses, causing all searches to fail.

Props RomSocial, swissspidy.
Fixes #36195.

git-svn-id: https://develop.svn.wordpress.org/trunk@36989 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 14:11:16 +00:00
Boone Gorges 0fdf0d4566 Improve error handling in `get_categories()`.
When passed an invalid `'taxonomy'`, `get_terms()` will return a `WP_Error`
object. This object should not be blindly cast to an array. Instead, an empty
array should be returned, to indicate that no matching terms have been found.

Props virgodesign, sebastian.pisula.
Fixes #36227.

git-svn-id: https://develop.svn.wordpress.org/trunk@36988 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 13:52:14 +00:00
Boone Gorges 8b564b6106 Fix test related to cap check in `get_edit_term_link()`.
The test was introduced in [36646] was intended to demonstrate that the cap
check in `get_edit_term_link()` uses the custom capability from the correct
taxonomy when `$taxonomy` is not specified but must be inferred from the
provided term. However, the test was wrongly written in pretty much every way.
Antiprops boonebgorges.

Props swissspidy.
See #35922.

git-svn-id: https://develop.svn.wordpress.org/trunk@36986 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-14 01:51:12 +00:00
John Blackbourn 93942d330e Correct a unit test for custom icon functionality.
See #36086


git-svn-id: https://develop.svn.wordpress.org/trunk@36952 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 19:58:49 +00:00
Konstantin Obenland cda0901425 Template: Explicitly set `full` as the default custom logo size.
See #33755.


git-svn-id: https://develop.svn.wordpress.org/trunk@36950 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 19:02:25 +00:00
Konstantin Obenland 6f69ca857e Tests: Introduce multisite unit tests.
Makes sure custom logo functions work for other sites within a network.
Fixes a bug in `get_custom_logo()` where the correct logo was returned, but
linked to the wrong site.

H/t ocean90.
See #33755, #36086.


git-svn-id: https://develop.svn.wordpress.org/trunk@36949 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-10 18:56:56 +00:00
Konstantin Obenland 6d951b3c5d Customize: Only add custom logo’s header text control if needed.
Dissolves `WP_CustomLogo` and adopts a structure similar to custom header and background (See `_delete_attachment_theme_mod()`).
The option to hide header text only gets added if it’s not already part of custom header, and only if selectors have been registered when theme support for custom logos was declared. Themes can add `postMessage` support for it as well.

Example:
{{{
add_theme_support( 'custom-logo', array(
    'size' => ‘large’,
    'header-text' => array( 'site-title', 'site-description' ),
) );
}}}

See #33755.


git-svn-id: https://develop.svn.wordpress.org/trunk@36915 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-09 23:43:49 +00:00
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