Commit Graph

1467 Commits

Author SHA1 Message Date
Boone Gorges 7f79d26ca5 Don't allow term meta to be added to shared taxonomy terms.
`add_term_meta()` and `update_term_meta()` identify terms by `$term_id`. In
cases where a term is shared between taxonomies, `$term_id` is insufficient to
distinguish where the metadata belongs.

When attempting to add/update termmeta on a shared term, a `WP_Error` object
is returned. This gives developers enough information to decide whether they'd
like to force the term to be split and retry the save, or show an error in the
UI, or whatever.

Props boonebgorges, mboynes, DH-Shredder, jorbin, aaroncampbell.
Fixes #34544.

git-svn-id: https://develop.svn.wordpress.org/trunk@35515 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:23:28 +00:00
Boone Gorges c8dd2d480d `WP_Comment_Query`: Fill comment objects from database when cache is unavailable.
This fixes a bug where widgets loaded in a preview or the Customizer are
rendered inside of a `wp_suspend_cache_addition()` block and thus could not
find comment objects in the cache.

Props rommelxcastro, stevehenty.
Fixes #34138.

git-svn-id: https://develop.svn.wordpress.org/trunk@35512 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 21:09:01 +00:00
Scott Taylor ee98fd84bb Feeds: `<comments>` is optional in RSS2, so don't include it when comments aren't present or open. Same for `<wfw:commentRss>` and `<slash:comments>`
Adds unit test.

Props swissspidy, realloc, hakre, sivel.
Fixes #9134.


git-svn-id: https://develop.svn.wordpress.org/trunk@35506 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 17:46:41 +00:00
Sergey Biryukov 00ee9a62d1 Add missing `@group` to `Tests_Rel_No_Follow`.
See #9959.

git-svn-id: https://develop.svn.wordpress.org/trunk@35505 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 16:35:02 +00:00
Andrew Ozz 01e9de382e Responsive images:
- Fix `_wp_upload_dir_baseurl()` to cache by blog_id.
- Replace `path_join()` with `trailingslashit()`, it's much faster.
- Rename $image_url to $image_src for consistency (used at about 50 other places).
- Couple of tests fixes.

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35498 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-04 00:21:23 +00:00
Sergey Biryukov 88c274fad8 Formatting: `wp_make_link_relative()` should return an empty string if no path is present in the link.
Props bcworkz, MikeHansenMe, chriscct7, SergeyBiryukov.
Fixes #26819.

git-svn-id: https://develop.svn.wordpress.org/trunk@35497 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-03 21:35:17 +00:00
Gary Pendergast c9f7e05f7b Upgrades: Add support for `FULLTEXT` indexes to `dbDelta()`.
Props edirect24, mdawaffe, pento.

Fixes #14445.



git-svn-id: https://develop.svn.wordpress.org/trunk@35487 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 23:09:49 +00:00
Weston Ruter 204bad4685 Customize: Return user to referring URL when leaving Customizer in absence of `return` query param.
When referring URL is not available, default returning user to frontend URL instead of admin URL. Themes page is updated to include the `return` path in Customizer links.

Props McGuive7, westonruter.
Fixes #32637.


git-svn-id: https://develop.svn.wordpress.org/trunk@35483 602fd350-edb4-49c9-b593-d223f7449a82
2015-11-01 06:39:50 +00:00
Scott Taylor bd7bf83886 Media: add a new image size, `medium_large`. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.


git-svn-id: https://develop.svn.wordpress.org/trunk@35479 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:49:26 +00:00
Scott Taylor 957a800bd3 Comments: don't auto-close comments on draft posts.
Adds unit tests.

Props solarissmoke, MikeHansenMe, nacin, rachelbaker.
Fixes #20262.


git-svn-id: https://develop.svn.wordpress.org/trunk@35475 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 20:12:16 +00:00
Sergey Biryukov fbd0b570fc Embeds: In `get_post_embed_html()`, move the optional `$post` argument after the required `$width` and `$height`.
Props swissspidy.
Fixes #34523.

git-svn-id: https://develop.svn.wordpress.org/trunk@35472 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-31 15:50:23 +00:00
Andrew Ozz 98a63f523f Responsive images:
- Merge `wp_image_srcset_attr()` into `wp_calculate_image_srcset()`.
- Remove the `wp_image_srcset` filter.
- Fix the tests for the above changes. 

See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35464 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 23:26:44 +00:00
John Blackbourn 3eb0e3a4bb Ensure that the scheme used in the URL returned by `get_blogaddress_by_id()` always reflects the blog's URL, instead of using `http`.
Props thomaswm
Fixes #14867


git-svn-id: https://develop.svn.wordpress.org/trunk@35446 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-30 02:01:32 +00:00
Gary Pendergast 63d9e9df96 Embeds: Provide a cached text fallback.
Sometimes, embedded sites might suffer from less than 100% uptime. Instead of leaving the embedding site with a big blank space where the embed should be, let's fall back to a link to the embedded post, so there's at least some context for the post.

Fixes #34462.



git-svn-id: https://develop.svn.wordpress.org/trunk@35437 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 23:10:46 +00:00
Gary Pendergast 4832d8d933 Embeds: Who put this REST API infrastructure in my WordPress?
Well, while it's here, we probably should make use of it. The oEmbed endpoint now uses the REST API infrastructure, instead of providing its own.

Props swissspidy.

Fixes #34207.



git-svn-id: https://develop.svn.wordpress.org/trunk@35436 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 22:50:13 +00:00
John Blackbourn 4b10def07e Correctly populate the `user_id` field for comments when a user submits a comment while logged in.
Props imath
Fixes #34493


git-svn-id: https://develop.svn.wordpress.org/trunk@35435 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 21:28:39 +00:00
Sergey Biryukov 391b67356a Embeds: Include post name in "Continue reading" links to provide a readable link for screenreaders.
Props swissspidy.
Fixes #34481.

git-svn-id: https://develop.svn.wordpress.org/trunk@35432 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-29 13:20:04 +00:00
Boone Gorges f1ca28c2ab Don't specify an `offset` default in `get_posts()`.
The default value should be a null offset. A `0` default overrides any value
of `paged` passed to `get_posts()`. See [34697].

Fixes #34060.

git-svn-id: https://develop.svn.wordpress.org/trunk@35417 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 18:17:27 +00:00
Andrew Ozz 855ba2518b Responsive images:
- Introduce `wp_calculate_image_srcset()` that replaces `wp_get_attachment_image_srcset_array()` and is used as lower level function for retrieving the srcset data as array.
- Use the new function when generating `srcset` and `sizes` on the front-end. This is faster as no (other) image API functions are used.
- Change the `wp_get_attachment_image_srcset()`. Now it is meant for use in templates and is no longer used in core.
- A few logic fixes and improvements.
- Some names changed to be (hopefully) more descriptive.
- Fixed/updated tests.

Props joemcgill, jaspermdegroot, azaozz.
See #34430.

git-svn-id: https://develop.svn.wordpress.org/trunk@35412 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-28 05:40:04 +00:00
Dominik Schilling (ocean90) 88cdbb6a49 Embeds: Replace hardcoded error messages with `get_status_header_desc( $http_code )`.
Fixes #34275.

git-svn-id: https://develop.svn.wordpress.org/trunk@35408 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-27 20:43:00 +00:00
Dion Hulse 8c33fe770e Use `wp_parse_url()` in `esc_url()` to avoid parsing bugs in < PHP 5.4.7.
Props johnbillion for unit tests
See #34408
Fixes #34202


git-svn-id: https://develop.svn.wordpress.org/trunk@35370 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:56:25 +00:00
Dion Hulse cacd015856 WP_HTTP: Promote the `WP_HTTP::parse_url()` method to a more generic `wp_parse_url()` function.
Fixes #34408


git-svn-id: https://develop.svn.wordpress.org/trunk@35369 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 05:53:05 +00:00
Dion Hulse f70e623991 XMLRPC: Revert the changes to `WP_XMLRPC_UnitTestCase` in [35366] as they weren't required.
See #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35367 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:49:08 +00:00
Dion Hulse 75ab50c70e XMLRPC: Prevent authentication from occuring after a failed authentication attmept in any single XML-RPC call.
This hardens WordPress against a common vector which uses multiple user identifiers in a single `system.multicall` call. In the event that authentication fails, all following authentication attempts ''in that call'' will also fail.

Props dd32, johnbillion.
Fixes #34336


git-svn-id: https://develop.svn.wordpress.org/trunk@35366 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-23 04:45:10 +00:00
Scott Taylor 6a3b784104 Media: in `wp_get_attachment_image_sizes()`, to streamline and for performance:
* Change the 3rd arg from `args` to `width`
* Change `wp_image_sizes_args` filter to `wp_get_attachment_image_sizes`

Updates unit tests.

Props joemcgill.
Fixes #34379.


git-svn-id: https://develop.svn.wordpress.org/trunk@35355 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:45:37 +00:00
Scott Taylor a19a0e6e72 oEmbed: if `SimpleXMLElement` does not exist, return an `HTTP Error 501 Not implemented` response.
Props swissspidy.
Fixes #34274.


git-svn-id: https://develop.svn.wordpress.org/trunk@35354 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 16:37:31 +00:00
John Blackbourn 1691563872 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35351 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-22 00:07:36 +00:00
John Blackbourn 82cb793355 Initialise `$_SERVER['SERVER_NAME']` during the test bootstrap to avoid individual tests having to do it.
Fixes #34394


git-svn-id: https://develop.svn.wordpress.org/trunk@35350 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 23:51:45 +00:00
John Blackbourn 5f8d0870a2 Remove the explicit Imagick extension test.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35348 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:40:48 +00:00
John Blackbourn 2c3c286b84 Correctly use `WP_TESTS_EMAIL` in email tests.
See #761, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35347 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:33:53 +00:00
John Blackbourn 20eb6402fd Correct some more tests which were using `example.org` instead of `WP_TESTS_DOMAIN`.
See #33641, #34000


git-svn-id: https://develop.svn.wordpress.org/trunk@35346 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:21:51 +00:00
John Blackbourn 63748f2d67 Provide a more helpful failure message when Imagick isn't installed. Skipping the tests isn't really an option because Imagick's presence affects several other tests too.
See #34087


git-svn-id: https://develop.svn.wordpress.org/trunk@35345 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:10:43 +00:00
John Blackbourn 289973f078 Remove the failing `test_rest_url_scheme()` test while it's investigated.
See #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35344 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 22:06:41 +00:00
John Blackbourn 672782f0a6 Force the REST API URL to use `https` for its scheme when the current request is served over HTTPS and the host name matches that of the REST API URL.
This allows sites to use an admin area over HTTPS with the front end over HTTP, and not end up with a cross-protocol problem when using the REST API URL in the admin area.

Fixes #34299


git-svn-id: https://develop.svn.wordpress.org/trunk@35342 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 20:37:56 +00:00
Drew Jaynes 1a7298861b Comments: Introduce two new filters, `notify_moderator` and `notify_post_author`, both of which make it possible to selectively override site notification email settings for new comments.
The `notify_moderator` filter makes it possible to override the value for the `moderation_notify` option, which controls whether to send new comment emails to "site moderators", that is to say, the owner of the admin email for the site and the post author if they have the ability to modify the comment.

The `notify_post_author` filter likewise makes it possible to override the value for the `comments_notify` option, which controls whether to send new comment emails to the post author. If the post author is the comment author, default behavior is not to send the notification. Note: enabling or disabling notifications via this hook could also affect other recipients added via the 'comment_notification_recipients' filter in `wp_notify_postauthor()`, if hooked.

Passing a falsey value to either of the new filters will prevent notifications from being sent, regardless of their corresponding option values.

Adds tests.

Props coffee2code, adamsilverstein, DrewAPicture.
Fixes #761.


git-svn-id: https://develop.svn.wordpress.org/trunk@35339 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 18:34:06 +00:00
Konstantin Obenland 52204f7b27 Tests: Use most specific function for document titles.
Adds tests specific to `_wp_render_title_tag()`.

See #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35334 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:54:53 +00:00
Boone Gorges f492a81d70 Prevent non-public taxonomies from registering aquery var.
[34247] made the 'public' paramater of `register_taxonomy()` work by blocking
requests for non-public taxonomy archives during `parse_request()`. Blocking
taxonomy archive requests this late means that it's impossible to register an
independent query var that matches the slug of a non-public taxonomy. By
moving the block to `register_taxonomy()` - not allowing these taxonomies to
register their query vars in the first place - we free up the slug for other
use. In addition, we free up a bit of processing (no need to look for the query
var in `parse_request()` and better parallel the way non-public post types
work. See `register_post_type()`.

Non-public taxonomy archives that are requested using `?taxonomy=tax_name` are
still blocked during `parse_request`. It's only custom query vars -
`?tax_name=term` - that are affected by this change.

Props mboynes.
Fixes #21949.

git-svn-id: https://develop.svn.wordpress.org/trunk@35333 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:53:51 +00:00
Boone Gorges e4b72ad5ca Don't force comment pagination.
[34561] instituted the policy of forcing pagination for comments. This strategy
was intended to avert problems when 'page_comments' is set to 0 - as it is by
default - and the number of comments on a given post rises into the hundreds or
thousands. By forcing pagination in all cases, we ensured that WordPress would
not time out by processing unwieldy numbers of comments on a given pageload.

The strategy proves problematic, however, because comment permalinks are
generated using the page of the comment. Forcing pagination for posts that
were not previously paginated would change the URL of all comments that do not
appear on the default comment page.

This changeset reintroduces the 'page_comments' setting and its corresponding
checkbox on Settings > Discussion. A number of tests, which were written after
[34561], are modified to work now that 'page_comments' will, once again, be
disabled by default.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@35331 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:25:31 +00:00
Boone Gorges 75887ec865 Document title tests should expect dynamic blogname.
Fixes #31078.

git-svn-id: https://develop.svn.wordpress.org/trunk@35329 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 16:14:06 +00:00
Scott Taylor 51637379a2 Formatting: move `url_shorten()` from `wp-admin/includes/misc.php` to `wp-includes/formatting.php` for more global access.
Adds unit tests.

Props mulvane, chriscct7.
Fixes #20166.


git-svn-id: https://develop.svn.wordpress.org/trunk@35314 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:47:23 +00:00
Scott Taylor 14893eb628 AJAX UNIT TESTS: Have you ever wondered why these take 600 forevers to run? They all eventually call `do_action( 'admin_init' )`, which has `_maybe_update_core`, `_maybe_update_plugins`, and `_maybe_update_themes` hooked to it. REMOVE THEM, and AJAX unit tests run like the wind. `Tests_Ajax_Response` is still slow.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35311 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 03:17:36 +00:00
Scott Taylor f5921a0c98 Unit Tests: consolidate the many separate implementations of `_make_attachment()` into a helper method on `WP_UnitTestCase`.
Fixes #34075.


git-svn-id: https://develop.svn.wordpress.org/trunk@35309 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-21 01:58:52 +00:00
Weston Ruter bde89adaf8 Customizer: Introduce `customize_loaded_components` filter to allow core components to be disabled.
Also move style rule from `customize-nav-menus.css` to `customize-controls.css` so that widgets button is properly styled when `nav_menus` component is excluded from loading. See [35304]. See #33327.

Props westonruter, DrewAPicture.
Fixes #33552.


git-svn-id: https://develop.svn.wordpress.org/trunk@35307 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:15:11 +00:00
Andrew Ozz 73d755b67a TinyMCE: update to 4.2.6. Changelog: http://www.tinymce.com/develop/changelog/?ctrl=version&act=view&pr_id=1&vr_id=887.
Fixes #34331.

git-svn-id: https://develop.svn.wordpress.org/trunk@35306 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 22:05:31 +00:00
Weston Ruter 261aa51182 Customizer: Allow new `option` settings to not be saved as autoloaded by passing an `autoload` arg value of `false`.
The `autoload` argument value is passed along to `update_option()` which has accepted an `$autoload` parameter since [31628].

Props westonruter, dlh.
See #26394.
Fixes #33499.


git-svn-id: https://develop.svn.wordpress.org/trunk@35305 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 21:18:04 +00:00
Weston Ruter 9724c7cdbd Customizer: Implement indicators for invalid nav menu items.
The same indicator on the nav menus admin page is now present for nav menu items in the Customizer. When a menu item is present for a post type that is no longer registered, the menu item will appear with the indicator.

Props kucrut, westonruter.
Fixes #33665.


git-svn-id: https://develop.svn.wordpress.org/trunk@35302 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 19:07:58 +00:00
Konstantin Obenland e9579b3ed5 Site Icon: Get site icon ID only when needed.
Cuts down on unnecessary queries, especially in environments that rely on
post meta a lot. Reverts [32997].

Props ap.koponen, swissspidy.
Fixes #34368.



git-svn-id: https://develop.svn.wordpress.org/trunk@35299 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 18:22:41 +00:00
Konstantin Obenland c7a86be42c Tests: Use updated filter names and oembed title for UT sanity.
See [35294], #31078.


git-svn-id: https://develop.svn.wordpress.org/trunk@35295 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 17:04:29 +00:00
Konstantin Obenland d625bd2428 Themes: Improve document title output.
Introduces more flexibility in filtering all parts of the document title,the
separator, and a way to short-circuit title generation. Plugins can now also
check for theme support and reliably filter the entire output. See #18548.
Deprecates `wp_title()`.

Fixes #31078.



git-svn-id: https://develop.svn.wordpress.org/trunk@35294 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 16:20:04 +00:00
Scott Taylor ea7e8314d2 Formatting: allow date strings to be passed to `get_gmt_from_date()`, instead of requiring `'Y-m-d H:i:s'`.
Adds unit tests.

Props pbearne.
Fixes #34279.


git-svn-id: https://develop.svn.wordpress.org/trunk@35284 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 06:07:45 +00:00
Scott Taylor 91d55f97c2 Users: when calling `wp_insert_user()` with an valid user ID, return `WP_Error` instead of arbitrarily updating user meta.
Adds unit test.

Props swissspidy, bilalcoder.
Fixes #28004.


git-svn-id: https://develop.svn.wordpress.org/trunk@35280 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 05:27:32 +00:00
Scott Taylor fdd8106001 Formatting: when making unique filenames in `wp_unique_filename()` by adding an incrementing number, prefix it with a dash to disambiguate from files that end in numbers.
Updates unit tests.

Props mikejolley, tyxla.
Fixes #21453.


git-svn-id: https://develop.svn.wordpress.org/trunk@35276 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-20 04:04:26 +00:00
Weston Ruter 42687da29c Widgets: Modify unit test assertion to be compatible with `widget_nav_menu` option being filtered by plugin to return `ArrayIterator`.
Modifies assertion added in [35100].

See #26876.
See #32474.


git-svn-id: https://develop.svn.wordpress.org/trunk@35272 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 21:26:24 +00:00
Drew Jaynes f03562b364 Tests: Add some more test coverage for `get_term_field()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35270 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 03:28:49 +00:00
Boone Gorges 990eebf373 Bust object term cache in `wp_remove_object_terms()`.
Props tszming.
Fixes #34338.

git-svn-id: https://develop.svn.wordpress.org/trunk@35268 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-19 01:52:22 +00:00
John Blackbourn 39c6a77617 Some cleanup that was missed in [35259].
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35260 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:25:25 +00:00
John Blackbourn 219b56a6a4 Some rewrite endpoint tests in preparation for new endpoint masks. More to come.
See #33728, #24853


git-svn-id: https://develop.svn.wordpress.org/trunk@35259 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 06:23:48 +00:00
John Blackbourn a314c6c234 Preserve the public and private query var properties on the global `WP` instance when using `WP_UnitTestCase::go_to()`. These properties apply to the application state, not the current request.
See #34346


git-svn-id: https://develop.svn.wordpress.org/trunk@35258 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 05:00:40 +00:00
John Blackbourn 9fbff7f63a Add `is_embed()` to `WP_UnitTestCase::assertQueryTrue()` and update the relevant embed tests.
See #32522


git-svn-id: https://develop.svn.wordpress.org/trunk@35257 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 04:50:15 +00:00
John Blackbourn 6845b3cd4a Move the `test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set()` test into a more appropriate place.
See #25143


git-svn-id: https://develop.svn.wordpress.org/trunk@35256 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 01:34:29 +00:00
John Blackbourn ab43e7362d Correct a test after r35253.
See #34272


git-svn-id: https://develop.svn.wordpress.org/trunk@35255 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-18 00:55:16 +00:00
John Blackbourn d5b31e6ba2 Introduce `map_deep()`, a utility function that recursively maps a callable function to every item in an array or object. Works like `array_walk_recursive()` but works with objects too.
Updates `rawurlencode_deep()`, `urlencode_deep()`, and `stripslashes_deep()` to use `map_deep()`. Introduces `urldecode_deep()` for completeness.

Props wpmuguru, nbachiyski, boonebgorges, MikeHansenMe, chriscct7, realloc, johnbillion
Fixes #22300


git-svn-id: https://develop.svn.wordpress.org/trunk@35252 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 23:25:21 +00:00
Scott Taylor 768958f7a0 Unit Tests: better fixtures for `Tests_Meta_Slashes` and `Tests_WP_Customize_Section`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35249 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:28:43 +00:00
Scott Taylor 80b732819b Unit Tests: better fixtures for `Tests_User_WpSetCurrentUser`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35248 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:18:38 +00:00
Scott Taylor 721d4c5a77 Unit Tests: better fixtures for `Tests_User`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35247 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 21:14:28 +00:00
Scott Taylor c173dc5595 Unit Tests: better fixtures for `Tests_AdminBar`. Don't force-delete some posts: some filter callbacks are no-ops on Multisite if the post is vanquished.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35246 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 20:48:33 +00:00
Scott Taylor 8506f48d6b Unit Tests: better fixtures for `Tests_Admin_Includes_Post`.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35245 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:47:07 +00:00
Scott Taylor 613e88fe86 Unit Tests: `WP_UnitTest_Generator_Sequence` needs a static incrementer - otherwise, it assumes every test class is a reset, which it no longer is (it is now static).
While we're at it, remove unnecessary `tearDown()` code.

See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35244 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 19:24:20 +00:00
Scott Taylor ae226d66b6 Unit Tests: after [35242], declare some missing instance props on individual test classes.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35243 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:29:32 +00:00
Scott Taylor b757b37551 Unit Tests: after [35225], make `factory` a method/getter on `WP_UnitTestCase` and add magic methods for BC for every plugin that is extending `WP_UnitTestCase` and accessing the `$factory` instance prop.
Props nerrad, wonderboymusic.
See #30017, #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@35242 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 18:02:16 +00:00
Weston Ruter 0e81f51cac Customizer: Add unit test for `WP_Customize_Widgets::is_panel_active()`.
See #33052.


git-svn-id: https://develop.svn.wordpress.org/trunk@35236 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 04:43:27 +00:00
Sergey Biryukov 9b591d6b09 Embeds: Rename files, functions, and hooks added in [34903] to make it more clear what is oEmbed-specific and what isn't.
See https://core.trac.wordpress.org/ticket/34272#comment:7 for full list of renamed functions and hooks.

Props swissspidy.
Fixes #34272.

git-svn-id: https://develop.svn.wordpress.org/trunk@35235 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-17 01:20:19 +00:00
Weston Ruter 370057b5d7 Customizer: Always show Widgets panel initially if sidebars are registered; show notice to users in panel if no widget areas are in current preview.
Widgets panel will not wait to display until the preview loads.

Also fixes problems with `margin-top` in panels where other panels' `active` states change, as well as ensuring sections of deactivated panel collapse before panel is hidden to prevent the pane from becoming empty of controls.

Fixes #33052.
Fixes #33567.


git-svn-id: https://develop.svn.wordpress.org/trunk@35231 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 23:47:56 +00:00
Boone Gorges f22ba848df Return `null` from `get_term()` on taxonomy mismatch.
[34997] caused `get_term()` to return an error object in the case when
`$taxonomy` did not match the taxonomy of the located term. This was an
inadvertant change from the previous behavior, when `get_term()` would return
null in these cases.

Props dlh.
See #14162. Fixes #34332.

git-svn-id: https://develop.svn.wordpress.org/trunk@35227 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:41:51 +00:00
Scott Taylor 61edcd5021 Unit Tests: PHP 5.2, I Hate You and You Are Bringing Me Down.
#YOLOFriday

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35226 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:14:52 +00:00
Scott Taylor e70ebea219 Unit Tests: one `$factory` to rule them all, and it shall be `static`.
Using more than one instance of `WP_UnitTest_Factory` causes all kinds of craziness, due to out-of-sync internal generator sequences. Since we want to use `setUpBeforeClass`, we were creating ad hoc instances. To avoid that, we were injecting one `static` instance via Dependency Injection in `wpSetUpBeforeClass`. All tests should really use the `static` instance, so we will remove the instance prop `$factory`.

Replace `$this->factory` with `self::$factory` over 2000 times.
Rewrite all of the tests that were hard-coding dynamic values. 

#YOLOFriday



git-svn-id: https://develop.svn.wordpress.org/trunk@35225 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 21:04:12 +00:00
Scott Taylor 84272ff8cd Unit Tests: since [32953], we can just use `self::delete_user()` instead of using `if` logic for Multisite.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35224 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 19:51:32 +00:00
Scott Taylor 2845280ffd Unit Tests: add `SpeedTrapListener` to `phpunit/includes` and add the config node to `phpunit.xml.dist`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35214 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-16 00:27:28 +00:00
Dominik Schilling (ocean90) c6e2e6c1b5 Tests: Remove the `@runTestsInSeparateProcesses` annotation for Ajax tests.
They were added 3 years ago in [846/tests] because tests weren't excluded from the normal runs.

Reverts [35209] because it doesn't work with Xdebug.
`Tests_Ajax_Response::test_response_charset_in_header` is the only test which needs to run in a separate process, see [975/tests].

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35211 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 21:30:52 +00:00
Dominik Schilling (ocean90) 666d07352e Tests: Don't preserve the global state for Ajax tests when using an external object cache.
Most of the Ajax tests are running in a separate PHP process, and thus PHPUnit attempts to preserve the global state from the parent process by serializing all globals. But this doesn't work for external object caches so we have to disable this "feature".

See #31491.

git-svn-id: https://develop.svn.wordpress.org/trunk@35209 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 20:34:08 +00:00
Boone Gorges 1b6a8019c3 Fix incorrect variable name introduced in [35197].
See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35206 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 18:47:11 +00:00
Scott Taylor 43d18b25b0 Unit Tests: add/upgrade the fixtures in `Tests_User_Query`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35197 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 07:28:40 +00:00
Scott Taylor 32719bf251 Unit Tests: create fewer terms in `Tests_Term_getTerms::test_get_terms_parent_zero()`
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35196 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:52:19 +00:00
Sergey Biryukov 65390cd9cf In `WP::parse_request()` and `url_to_postid()`, if a post slug clashes with a trashed page, return the post instead of the page.
Props kovshenin, SergeyBiryukov, igmoweb.
Fixes #21970.

git-svn-id: https://develop.svn.wordpress.org/trunk@35195 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:48:22 +00:00
Scott Taylor 0cf7a91d3a Unit Tests: upgrade the fixtures in `Tests_Post_Thumbnail_Template`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35194 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:39:43 +00:00
Scott Taylor a65f390db6 Unit Tests: upgrade the fixtures in `Tests_Post_Revisions`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35193 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 06:31:16 +00:00
Scott Taylor 5fc726c222 Unit Tests: in `Tests_Comment_Query::test_get_comments_for_post()`, create fewer comments (5, instead of 10).
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35192 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:56:47 +00:00
Scott Taylor d424f690d2 Unit Tests: after [35186], "upgrade" the Canonical fixtures.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35191 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:50:40 +00:00
Sergey Biryukov e675e2ccf0 Users: Add `'illegal_user_logins'` filter to allow certain usernames to be blacklisted.
Props danielbachhuber, chriscct7, crazycoolcam, SergeyBiryukov.
Fixes #27317.

git-svn-id: https://develop.svn.wordpress.org/trunk@35189 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:42:05 +00:00
Scott Taylor 742082c042 Unit Tests: create more fixtures for `Tests_User`. When using a factory to create ad hoc users, use the inherited static prop `$static_factory` instead of the instance prop, `$factory`. If 2 factories are used out of sync, the generator sequences diverge and dupes can be created, causing an untold number of unforeseen errors. Yay.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35188 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 05:29:40 +00:00
Scott Taylor 16d98ebf73 Unit Tests: implement `setUpBeforeClass()` and `tearDownAfterClass()` on `WP_UnitTestCase`. Use late static binding (plus a gross fallback for PHP 5.2) to check if `wpSetUpBeforeClass()` or `wpTearDownAfterClass()` exist on the called class, and then call it and pass a static `WP_UnitTest_Factory` instance via Dependency Injection, if it exists.
This makes it way easier to add fixtures, and tear them down, without needing to instantiate `WP_UnitTest_Factory` in every class - removes the need to call `commit_transaction()` in each individual class.

See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35186 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 04:43:37 +00:00
Scott Taylor e1a09eff54 Unit Tests: in `Tests_Term`, create fixtures for posts.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35185 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:47:36 +00:00
Scott Taylor 8cc22363db Unit Tests: in `Tests_Post`, create fixtures for users.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35183 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 03:30:09 +00:00
Scott Taylor 3cc9adb890 Unit Tests: in `Tests_Media::test_wp_get_attachment_image_srcset_array_no_width()`, just toggle metadata, instead of creating a new attachment. Shaves 75ms off the test.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35181 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 02:54:20 +00:00
Scott Taylor 011c1a2e2c Unit Tests: make a fixture in `Tests_Media` to represent the large image, instead of creating it 10 times.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35179 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:42:27 +00:00
Scott Taylor 75e4de9671 Unit Tests: move some oEmbed tests that can trigger HTTP calls to `Tests_External_HTTP_OEmbed`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35178 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:28:05 +00:00
Scott Taylor fc7efaf9b1 Unit Tests: `Tests_Canonical` doesn't need to call `wp_set_current_user()` or implement `tearDown` because its grandparent calls `wp_set_current_user( 0 )` in `tearDown()`.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35177 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:17:22 +00:00
Scott Taylor a270d619ad Unit Tests: `Tests_Comment` needs a `tearDownAfterClass` impl to avoid spillage.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35176 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:05:50 +00:00
Scott Taylor 9d5c7055e6 Unit Tests: `Tests_Auth` needs a `tearDownAfterClass` impl to avoid spillage.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35175 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 01:03:16 +00:00
Scott Taylor 5fc04e0e26 Unit Tests: call `commit_transaction()` in `Tests_Auth` set up.
See #30017, #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@35174 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-15 00:48:22 +00:00