Commit Graph

1339 Commits

Author SHA1 Message Date
Boone Gorges ed4eee668e Don't cache `WP_Term` objects in `wp_get_object_cache()`.
The data stored in the cache should be raw database query results, not
`WP_Term` objects (which may be modified by plugins, and may contain additional
properties that shouldn't be cached).

If term relationships caches were handled in `wp_get_object_terms()` - where
a database query takes place - it would be straightforward to cache raw data.
See #34239. Since, in fact, `get_the_terms()` caches the value it gets from
`wp_get_object_terms()`, we need a technique that allows us to get raw data
from a `WP_Term` object. Mirroring `WP_User`, we introduce a `data` property
on term objects, which `get_the_terms()` uses to fetch cacheable term info.

Fixes #34262.

git-svn-id: https://develop.svn.wordpress.org/trunk@35032 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 15:12:29 +00:00
Boone Gorges e8b0d11989 Fix incorrect setup in 'tag' query var test.
The test, introduced in [33724], was intended to demonstrate the behavior of
`example.com?tag=foo` routing. But an error in the test setup meant that a
URL-encoded tag object was being set as the value of 'tag'. Due to a quirk in
the way that `parse_request()` parses query vars, an object value for 'tag'
would inadvertently produce correct results in certain cases. But it's not a
usage we actively support, and it's not what was meant to be tested.

See #33532, #34262.

git-svn-id: https://develop.svn.wordpress.org/trunk@35030 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 15:03:43 +00:00
Boone Gorges 8847a58443 Don't require a `$taxonomy` to be specified in `get_term_field()`.
After [34997], the `$taxonomy` parameter of `get_term()` is optional. This
changeset brings `get_term_field()` in line with the new usage.

Adds unit tests for `get_term_field()`.

Props DrewAPicture.
See #34245.

git-svn-id: https://develop.svn.wordpress.org/trunk@35028 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-12 04:13:25 +00:00
Jeremy Felt 3ee40d6652 MS: Reject truthy, non-numeric network ids in `_network_option()`.
A valid `$network_id` or `null`/`false` is expected as the first parameter for `_network_option()`. If something other than that is passed, we immediately return `false` rather than attempting to guess what network was intended.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@35025 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-11 23:29:55 +00:00
Jeremy Felt 55122c1538 MS: Adjust `_network_option()` parameter order, `$network_id` is first.
This better aligns with expectations and matches the structure used by `_blog_option()`. The `_site_option()` functions remain as an appropriate method for working with the current network.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@35024 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-11 22:43:59 +00:00
Jeremy Felt d5e572f992 MS: Handle the possibility of 0 when checking a user's upload quota.
Upload space of 0 is now more possible via r35016 and should be respected rather than modified to a default of 10MB.

Fixes #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@35017 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 23:17:01 +00:00
Jeremy Felt d9edf86faf MS: Allow for a `blog_upload_space` setting of 0 to restrict uploads.
Previously, an value matching `empty()` would have been bypassed in favor of the default setting for 100MB.

Related #19538, r19639, r19652, where we saw the bug, fixed the bug, and then unfixed the bug so that it was not a surprise in a point release.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@35016 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 23:14:11 +00:00
Weston Ruter e158ff27de Customizer: Fix scalability performance problem for previewing multidimensional settings.
As the number of multidimensional settings (serialized options and theme mods) increase for a given ID base (e.g. a widget of a certain type), the number of calls to the `multidimensional` methods on `WP_Customize_Setting` increase exponentially, and the time for the preview to refresh grows in time exponentially as well.

To improve performance, this change reduces the number of filters needed to preview the settings off of a multidimensional root from N to 1. This improves performance from `O(n^2)` to `O(n)`, but the linear increase is so low that the performance is essentially `O(1)` in comparison. This is achieved by introducing the concept of an "aggregated multidimensional" setting, where the root value of the multidimensional serialized setting value gets cached in a static array variable shared across all settings.

Also improves performance by only adding preview filters if there is actually a need to do so: there is no need to add a filter if there is an initial value and if there is no posted value for a given setting (if it is not dirty).

Fixes #32103.


git-svn-id: https://develop.svn.wordpress.org/trunk@35007 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 09:05:04 +00:00
Boone Gorges d6748bd2cb Return `WP_Post` objects from `wp_get_object_terms()`.
A side effect of this change is that terms stored in the cache no longer have
an `object_id` associated with them. Previously, `object_id` had always been
cached when the term cache was populated via `wp_get_object_terms()`, a
strategy that was mostly harmless but still incorrect.

See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34999 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 03:38:41 +00:00
Boone Gorges 797ddb60ba Return `WP_Term` objects from `get_terms()`.
Props boonebgorges, flixos90, DrewAPicture.
See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34998 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 02:12:40 +00:00
Boone Gorges 134a7af0fc Introduce `WP_Term`.
`get_term()` now returns a `WP_Term` object, instead of a `stdClass` object.
Cache support and sanitization filters for individual terms are now more
centralized. For example, `get_term_by()` is able to cast results of its query
to a `WP_Term` object by passing it through `get_term()`.

The `$taxonomy` parameter for `get_term()` is now optional, as terms ought to
be unique to a taxonomy (ie, shared terms no longer exist). In cases where
`get_term()` detects that the term matching the specified term_id is from the
wrong taxonomy, it checks to see if you've requested a shared term, and if so,
it splits the term. This is used only for fallback purposes.

The elimination of shared terms allows the caching strategy for terms to be
simplified. Individual terms are now cached in a single 'terms' bucket.

Props flixos90, boonebgorges, scribu, dipesh.kakadiya.
See #14162.

git-svn-id: https://develop.svn.wordpress.org/trunk@34997 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-10 01:58:37 +00:00
Boone Gorges dc2b7c634d Ensure that `WP_Date_Query` accepts a value of `0` for 'hour'.
Props jim912.
Fixes #34228.

git-svn-id: https://develop.svn.wordpress.org/trunk@34989 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-09 16:32:59 +00:00
Drew Jaynes 6350d90339 Tests: Add basic DocBlocks for four helper methods in general/template.php used to assist testing the Site Icon feature.
All four helpers were introduced in the feature merge for 4.3.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34983 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-09 04:34:29 +00:00
John Blackbourn bc043c51e8 Introduce the ability to filter the Users admin listing screen by users with no role, if such users exist.
Fixes #22993
Props spmlucas, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34965 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 22:06:46 +00:00
Boone Gorges fa1e061dac `WP_User_Query` role improvement redux.
It's back, and it's better than ever: an overhaul of role-related arguments
in `WP_User_Query`. This updated version of the previously-reverted [34875]
includes support for the use of `$blog_id` without specifying a `$role`, for
a 99.7% reduced chance of breaking wordpress.org and other large sites.

Props boonebgorges, swissspidy.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@34959 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 21:27:04 +00:00
Drew Jaynes a6e9d49467 Administration: Add the ability to pass an array of screen IDs to `add_meta_box()` and `remove_meta_box()`.
The `$screen` parameter in both functions can now accept a single screen ID, `WP_Screen` object, or an array of screen IDs.

Adds tests.

Props coffee2code, iamfriendly, madalinungureanu, mordauk, igmoweb, meloniq, DrewAPicture.
See #15000.


git-svn-id: https://develop.svn.wordpress.org/trunk@34951 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 19:06:32 +00:00
Konstantin Obenland 7e923cc0fe Template: Add fallback for empty containers.
Since [14031] the container can be omitted in `wp_nav_menu()`. It can not
however in `wp_page_menu()`, which creates a conflict if it is set as
the fallback, Let's make sure there is always a valid container tag.

Fixes #33974.



git-svn-id: https://develop.svn.wordpress.org/trunk@34950 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 18:26:13 +00:00
Boone Gorges a1389117b2 Allow a null `id` to do a `name` lookup in `wp_set_current_user()`.
Previously, the `name` fallback was failing in the case where the current user
was 0, due to a loose comparison between 0 (the current user) and `null` (the
value that is used to trigger the `name` fallback).

Props bobbingwide.
Fixes #20845.

git-svn-id: https://develop.svn.wordpress.org/trunk@34947 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 17:28:34 +00:00
Boone Gorges 5c496e841a Add tests for current behavior of `wp_set_current_user()`.
See #20845.

git-svn-id: https://develop.svn.wordpress.org/trunk@34945 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 17:19:00 +00:00
Boone Gorges 9c9cdf28ca Allow excluded keywords when searching posts.
Pass a keyword with a leading hyphen to exclude posts containing that keyword.
For example, 'taco -onions' will return posts that contain the word 'taco' but
do not contain the word 'onions'.

Props akibjorklund.
Fixes #33988.

git-svn-id: https://develop.svn.wordpress.org/trunk@34934 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 03:17:22 +00:00
John Blackbourn ba7dc01639 Abstract the shortcode attribute parsing regex into its own function, update the JavaScript counterpart, and introduce a test to ensure they do not diverge again.
Fixes #34191
Props miqrogroove, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34933 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 03:11:59 +00:00
Ryan McCue b39211475d REST API: Introduce baby API to the world.
Baby API was born at 2.8KLOC on October 8th at 2:30 UTC. API has lots
of growing to do, so wish it the best of luck.

Thanks to everyone who helped along the way:

Props rmccue, rachelbaker, danielbachhuber, joehoyle, drewapicture,
adamsilverstein, netweb, tlovett1, shelob9, kadamwhite, pento,
westonruter, nikv, tobych, redsweater, alecuf, pollyplummer, hurtige,
bpetty, oso96_2000, ericlewis, wonderboymusic, joshkadis, mordauk,
jdgrimes, johnbillion, jeremyfelt, thiago-negri, jdolan, pkevan,
iseulde, thenbrent, maxcutler, kwight, markoheijnen, phh, natewr,
jjeaton, shprink, mattheu, quasel, jmusal, codebykat, hubdotcom,
tapsboy, QWp6t, pushred, jaredcobb, justinsainton, japh, matrixik,
jorbin, frozzare, codfish, michael-arestad, kellbot, ironpaperweight,
simonlampen, alisspers, eliorivero, davidbhayes, JohnDittmar, dimadin,
traversal, cmmarslender, Toddses, kokarn, welcher, and ericpedia.

Fixes #33982.


git-svn-id: https://develop.svn.wordpress.org/trunk@34928 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-08 02:30:18 +00:00
John Blackbourn 4046919a11 Avoid stripping square brackets from URLs, and instead correctly encode them. Square brackets must be encoded in the path, path parameters, query parameters, and fragment, but must not be encoded in anything up to the domain and port.
Adds tests.

Fixes #16859


git-svn-id: https://develop.svn.wordpress.org/trunk@34920 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 23:38:22 +00:00
Boone Gorges f9f92b223d Handle `WP_User` objects properly in `update_user_caches()`.
We should not be storing the `WP_User` object in the cache, as it may contain
usermeta and other data that's cache elsewhere.

Props dd32.
See #24635.

git-svn-id: https://develop.svn.wordpress.org/trunk@34919 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 22:41:07 +00:00
Boone Gorges e1d7108e79 Add tests for `update_user_caches()`.
See #24635.

git-svn-id: https://develop.svn.wordpress.org/trunk@34918 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 22:34:32 +00:00
John Blackbourn e40575aa99 Correctly set the scheme of the `home` and `siteurl` options when creating a new site on multisite that uses some combination of HTTPS in the admin area or on the front end.
Fixes #33620
Props tryon, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@34916 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 21:45:17 +00:00
John Blackbourn 6705184dcc Correctly encode the `url` parameter that gets passed to WordPress' own oEmbed endpoint URL.
Fixes #34193
Props ocean90


git-svn-id: https://develop.svn.wordpress.org/trunk@34915 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 21:42:36 +00:00
Gary Pendergast 43bd3d46c9 Embeds: Add oEmbed provider support.
For the past 6 years, WordPress has operated as an oEmbed consumer, allowing users to easily embed content from other sites. By adding oEmbed provider support, this allows any oEmbed consumer to embed posts from WordPress sites.

In addition to creating an oEmbed provider, WordPress' oEmbed consumer code has been enhanced to work with any site that provides oEmbed data (as long as it matches some strict security rules), and provides a preview from within the post editor.

For security, embeds appear within a sandboxed iframe - the iframe content is a template that can be styled or replaced entirely by the theme on the provider site.

Props swissspidy, pento, melchoyce, netweb, pfefferle, johnbillion, extendwings, davidbinda, danielbachhuber, SergeyBiryukov, afercia

Fixes #32522.



git-svn-id: https://develop.svn.wordpress.org/trunk@34903 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 10:35:18 +00:00
Jeremy Felt cce73768b3 Tests: Remove static capture of space used and space allowed.
Originally introduced in [34601], this was necessary to avoid test pollution. Now that things have been separated and written to play nicely, we can remove this.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34902 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 07:24:47 +00:00
Jeremy Felt dadd89575f Tests: Improve tests for `upload_is_user_over_quota()`.
* Move all tests to a new 'multisite/uploadIsUserOverQuota.php'
* Use `get_space_allowed` and `pre_get_space_used` filters to help avoid test pollution.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34901 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 07:20:45 +00:00
Jeremy Felt b41be4c55c Tests: Account for non-numeric strings in tests for `get_space_allowed()`.
Provides a specific test for a case where a non-numeric strings are assigned to `blog_upload_space` at both the site and network levels.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34900 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 06:16:58 +00:00
Jeremy Felt b947cad868 Tests: Improve tests for `is_upload_space_available()`.
* Move all tests to a new 'multisite/isUploadSpaceAvailable.php'
* Store original `blog_upload_space` values before the class is loaded.
* Restore these values after each test tear down to avoid pollution.

Commit to testing `is_upload_space_available()` itself by always filtering the amount of space used through `pre_get_space_used`. This allows us to sanely test without worrying about the local environment. In the future, we may be able to remove some of these tests as `get_upload_space_available()` tests are built out and reliable.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34899 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 06:14:14 +00:00
Jeremy Felt 8cf73c132d Tests: Improve tests for `get_space_allowed()`.
* Move all tests to a new `multisite/getSpaceAllowed.php`
* Store original `blog_upload_space` values before the class is loaded.
* Restore these values after each test tear down to avoid pollution.
* Add a comprehensive set of expectations and results via data provider.

See #34037.


git-svn-id: https://develop.svn.wordpress.org/trunk@34898 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 04:57:12 +00:00
Scott Taylor 84df5f067c Rewrite/Permalinks/Canonical: in `url_to_postid()`, call `set_url_scheme()` on the URL to combat mixed content issues and find posts cross-scheme.
Adds unit tests.

Props swissspidy.
Fixes #34144.


git-svn-id: https://develop.svn.wordpress.org/trunk@34890 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-07 01:06:58 +00:00
Aaron Jorbin 351beec384 Revert [34875] due to unintentional breaking change
WordPress.org was taken down due to as Otto42 describes:

The previous version of this function added the query piece for the meta key = blog_id.capabilities, regardless of whether or not a role was requested. This limits the users returned to those with some defined role on this particular multisite instance.

See #22212




git-svn-id: https://develop.svn.wordpress.org/trunk@34880 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 20:57:35 +00:00
Aaron Jorbin f17e457a16 Add message with status info to temperamental assertion.
The ajax delete comment tests are intermittently failing. Many of the assertions make it hard to tell why they are failing. This adds a message to one of those assertions that contains some info on what is being asserted with the goal that it helps developers understand why the failure is failing.

See #33968



git-svn-id: https://develop.svn.wordpress.org/trunk@34879 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 19:55:56 +00:00
Boone Gorges 1949734cf3 Improve role-related arguments in `WP_User_Query`.
* 'role' now accepts an array or comma-separated list of role names. When passing multiple values for 'role', `WP_User_Query` will only match users that have all of the specified roles.
* 'role__in' accepts an array of role names, and allow the filtering of matched users to those with at least one of the specified roles.
* 'role__not_in' accepts an array of role names, and allows the filtering of matched users to those who have none of the specified roles.

Props swissspidy, mordauk, barrykooij, sirbrillig.
Fixes #22212.

git-svn-id: https://develop.svn.wordpress.org/trunk@34875 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 17:39:23 +00:00
Aaron Jorbin 7825c097b8 Adjust detection of stream timeouts in maybe skip tests for https tests
This is a follow up to [34848].

See #33968.



git-svn-id: https://develop.svn.wordpress.org/trunk@34874 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 17:39:14 +00:00
Sergey Biryukov f5b64d1674 Fix typo in [34848].
See #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@34872 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 17:27:12 +00:00
Drew Jaynes 3aca4edffa Tests: Update `Tests_Rewrite_AddRewriteRule->setUp()` to use the new `set_permalink_structure()` helper.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34870 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 16:01:38 +00:00
Drew Jaynes 7fe6d71d36 Users: Don't typo `assertTrue()` in a the uppercase letters `validate_username()` test.
See #24618.


git-svn-id: https://develop.svn.wordpress.org/trunk@34859 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 07:09:30 +00:00
Drew Jaynes 086d49daec Users: Add a separate test for checking the validity of a username containing uppercase characters in the scope of single vs multisite.
'JohnDoe' in single site: valid
'JohnDoe' in multisite: invalid

See #24618.


git-svn-id: https://develop.svn.wordpress.org/trunk@34858 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 07:01:32 +00:00
Gary Pendergast 536ba180df Tests: Dequeue the styles and scripts enqueued by `Test_WP_Customize_Nav_Menus::test_enqueue_scripts()`.
Fixes #34163.



git-svn-id: https://develop.svn.wordpress.org/trunk@34857 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 05:47:17 +00:00
Drew Jaynes afe594bb7c Users: Empty sanitized usernames should be considered invalid when passed through `validate_username()`.
Adds tests.

Props gwinhlopez for the initial patch.
Props mordauk, chriscct7.
Fixes #24618.


git-svn-id: https://develop.svn.wordpress.org/trunk@34856 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 05:34:47 +00:00
Scott Taylor fabd554bb2 Merge the Responsive Images feature plugin into core, initial commit. See: https://github.com/ResponsiveImagesCG/wp-tevko-responsive-images/
New functions in `media.php`:
* `wp_get_attachment_image_srcset_array()` - Returns an array of image candidate string data used to build a `srcset` value for an attachment given an `$attachement_id` and `$size`.
* `wp_get_attachment_image_srcset()` - Returns the `srcset` value for an attachment given an `$attachement_id` and `$size`.
* `wp_get_attachment_image_sizes()` - Returns the `sizes` value for an attachment given an `$attachement_id` and `$size` and optional arguments used to alter its output.
* `wp_make_content_images_responsive()` - A display filter for adding `srcset` and `sizes` to images embedded in content.
* `wp_img_add_srcset_and_sizes()` - A utility function used by `wp_make_content_images_responsive()` to add `srcset` and `sizes` to a single `<img>` element.

Modifies existing core functions:
* Modify `wp_get_attachment_image()` so the HTML returned for an image includes `srcset` and `sizes`.
* Modify `get_media_embedded_in_content()` (sup, 3.6 leftover) by adding `<img>` to the list of accepted tags that can be matched in content. This is used in `wp_make_content_images_responsive()` to find all of the images embedded in content before passing them off to `wp_img_add_srcset_and_sizes()`.

Tests:
* Add a new factory method to `WP_UnitTest_Factory_For_Attachment` named `create_upload_object()`
* Adds unit tests
* Updates unit tests

Props joemcgill, tevko, jaspermdegroot, mdmcginn, barryceelen, peterwilsoncc, fsylum, wonderboymusic, chriscoyier, benjaminpick, jrfnl, #12kingkool68, janhenckens, ryanmarkel, side777, ryelle, wturrell, micahmills, mattbagwell, coliff, DrewAPicture.
See #33641.


git-svn-id: https://develop.svn.wordpress.org/trunk@34855 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 04:58:21 +00:00
Gary Pendergast da7ddeaeab Tests: Make the Attachment Slashes tests clean up after itself.
Fixes #34162.



git-svn-id: https://develop.svn.wordpress.org/trunk@34852 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 04:00:53 +00:00
Aaron Jorbin 7764297d7b Fix whitespace issues introduced in [34848]
Bad Jorbin.

See #33968


git-svn-id: https://develop.svn.wordpress.org/trunk@34849 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 03:40:46 +00:00
Aaron Jorbin ba06fc4f5b HTTP timeouts should cause some tests to be skipped, not failed
A number of the HTTP external tests can inconstantly fail. As the HTTP API is one that doesn't change often, this failure creates noise. With the goal of increasing the signal from the unit tests, these tests are now skipped if they timeout. A notice is added when running the external http tests so that the developer knows what skipped tests may mean here.

See #33968



git-svn-id: https://develop.svn.wordpress.org/trunk@34848 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 03:36:18 +00:00
Scott Taylor f3f892ce46 Rewrite: add tests for `add_rewrite_rule()`.
Props DrewAPicture.
See #16840.


git-svn-id: https://develop.svn.wordpress.org/trunk@34847 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-06 03:35:14 +00:00
Weston Ruter 84e475dd80 Customizer: Ensure `WP_Customize_Setting::update()` returns boolean value.
Adds unit tests for `WP_Customize_Setting::save()` (and `WP_Customize_Setting::update()`), along with the actions `customize_update_{$type}`, and `customize_save_{$id_base}` which they trigger.

Fixes #34140.


git-svn-id: https://develop.svn.wordpress.org/trunk@34838 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-05 21:57:32 +00:00
Boone Gorges 578134d4ff Use `wp_installing()` instead of `WP_INSTALLING` constant.
The `WP_INSTALLING` constant is a flag that WordPress sets in a number of
places, telling the system that options should be fetched directly from the
database instead of from the cache, that WP should not ping wordpress.org for
updates, that the normal "not installed" checks should be bypassed, and so on.

A constant is generally necessary for this purpose, because the flag is
typically set before the WP bootstrap, meaning that WP functions are not yet
available.  However, it is possible - notably, during `wpmu_create_blog()` -
for the "installing" flag to be set after WP has already loaded. In these
cases, `WP_INSTALLING` would be set for the remainder of the process, since
there's no way to change a constant once it's defined. This, in turn, polluted
later function calls that ought to have been outside the scope of site
creation, particularly the non-caching of option data. The problem was
particularly evident in the case of the automated tests, where `WP_INSTALLING`
was set the first time a site was created, and remained set for the rest of the
suite.

The new `wp_installing()` function allows developers to fetch the current
installation status (when called without any arguments) or to set the
installation status (when called with a boolean `true` or `false`). Use of
the `WP_INSTALLING` constant is still supported; `wp_installing()` will default
to `true` if the constant is defined during the bootstrap.

Props boonebgorges, jeremyfelt.
See #31130.

git-svn-id: https://develop.svn.wordpress.org/trunk@34828 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-05 15:05:26 +00:00
Drew Jaynes b1ed6b5f18 Widgets: Add more tests for registering and unregistering sidebars with 1) no ID, 2) a string ID, 3) a numeric ID.
See #17078.


git-svn-id: https://develop.svn.wordpress.org/trunk@34817 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-04 05:22:11 +00:00
Drew Jaynes 572fd0a45b Widgets: Add tests for `dynamic_sidebar()` where sidebars were registered with 1) no supplied ID, 2) a numeric ID, 3) a string ID.
See #17078.


git-svn-id: https://develop.svn.wordpress.org/trunk@34816 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-04 04:43:46 +00:00
Boone Gorges ffa997a342 Update the taxonomy relationship cache in `is_object_in_term()`.
This function attempts to read from the relationship cache, and uses any data
it finds. If it finds no data, it does a query for the data it needs. Since we
are going to the trouble to query for the relationships, and since we are
already using cached data when available, let's go ahead and cache it for
later use.

Props joehoyle, boonebgorges.
Fixes #32044.

git-svn-id: https://develop.svn.wordpress.org/trunk@34812 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 21:18:55 +00:00
Drew Jaynes 0ea2acb720 Tests: Permalink Structures Phase II: DRY up logic for setting permalink structures in test methods.
Renames `reset_permalinks()` to `set_permalink_structure()` (mimicking `$wp_rewrite->set_permalink_structure()`) and allows it to accept an optional permalink structure. In this way, we can double dip using it to both set and reset the permalink structure from anywhere.

Removes alot of duplicated code from tests.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34810 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 20:54:11 +00:00
Boone Gorges eebe549408 When creating terms, avoid false dupe checks due to accented characters.
`wp_insert_term()` doesn't allow the creation of a term when the term `name`
is the same as another term in the same hierarchy level of the same taxonomy.
Previously, this duplicate check used `get_term_by( 'name' )`, which uses the
database collation to determine sameness. But common collations do not
distinguish between accented and non-accented versions of a character. As a
result, it was impossible to create a term 'Foo' if a sibling term with an
accented character existed.

We address this problem by using `get_terms()` to do the duplicate check. This
query returns all potentially matching terms. We then do a stricter check
for equivalence in PHP, before determining whether one of the matches is
indeed a duplicate.

Props boonebgorges, tyxla, geza.miklo, mehulkaklotar.
Fixes #33864.

git-svn-id: https://develop.svn.wordpress.org/trunk@34809 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 20:24:09 +00:00
Drew Jaynes 01f25fa247 Tests: Last try: It's redundant to reset permalinks on `tearDown()` if we're already doing it on every `setUp()`.
Removes the restoration logic, which leveraged a static property initialized with `get_option()`.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34807 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:26:24 +00:00
Boone Gorges 3b89b3ca28 Use 'comments_per_page' option as fallback in `get_page_of_comment()`.
The function now uses the following order of precedence when calculating
comment pagination: 1. the 'per_page' value passed in the `$args` array,
2. the 'comments_per_page' query var in `$wp_query`, and 3. the
'comments_per_page' setting from options-discussion.php. This change allows
`get_page_of_comment()` to return an accurate value before the main query
has been run.

Props laceous.
See #13939.

git-svn-id: https://develop.svn.wordpress.org/trunk@34806 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:25:25 +00:00
Boone Gorges ddc75e22ee Only count top-level comments when calculating threaded pagination.
The change in [34535] did not properly account for threading.

See #13939, #11334.

git-svn-id: https://develop.svn.wordpress.org/trunk@34805 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 19:15:55 +00:00
Boone Gorges b240a2a939 Ensure that `WP_User_Query` vars are filled after 'pre_get_users'.
This prevents notices from being thrown when a 'pre_get_users' callback
removes required values from the list of `query_vars`.

For backward compatibility with previous uses of 'pre_get_users', default
values are parsed both before and after the action is fired.

Fixes #33449.

git-svn-id: https://develop.svn.wordpress.org/trunk@34804 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 18:44:40 +00:00
Drew Jaynes 9cdffaaed8 Tests: Move the global permalinks reset routine to only fire when running core tests.
Should fix intermittent mysqli response errors in the AJAX tests.

See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34803 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 18:35:58 +00:00
Drew Jaynes adffdab161 Tests: Introduce `WP_UnitTestCase::reset_permalinks()`, an attempt to DRY up logic for resetting and restoring default permalinks on `setUp()` and `tearDown()`.
See #33968.


git-svn-id: https://develop.svn.wordpress.org/trunk@34802 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 17:14:12 +00:00
Sergey Biryukov 4fc732d804 Add missing unit tests from [34799].
Props johnbillion.
See #34059.

git-svn-id: https://develop.svn.wordpress.org/trunk@34801 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-03 15:09:57 +00:00
John Blackbourn 48300f62b3 Introduce support for array format field names in `WP_Widget::get_field_name()` and `WP_Widget::get_field_id()`.
Fixes #12133
Props ch1902, welcher


git-svn-id: https://develop.svn.wordpress.org/trunk@34780 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 20:23:54 +00:00
Jeremy Felt 464f857316 MS: Introduce `*_network_option` functions.
Introduces `add_network_option()`, `update_network_option()`, `get_network_option()`, and `delete_network_option()`, which use the internals previously found in the `*_site_option()` functions and allow for a network ID to enable cross network storage and retrieval of network options.

* `*_site_option()` functions are now wrappers for `*_network_option()` and will interact with options for the current network in a multisite environment.
* All will continue to fallback to `*_option()` for non-multisite uses.
* Adds basic tests for cross network storage and retrieval.
* Existing tests for `*_site_option()` functions provide coverage for storage and retrieval of current network options.

Props spacedmonkey, DrewAPicture, jeremyfelt.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34777 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 18:00:30 +00:00
Boone Gorges 44d021b686 More explicit tests for `image_get_intermediate_size()`.
After [33807], `Tests_Image_Intermediate_Size::test_get_intermediate_sizes_by_array_zero_width()`
was failing intermittently. This failure was due to the use of a random number
for the image height. When the height was sufficiently large - $height >= 202 -
to change the aspect ratio of the cropped image (based on WP's threshold of a
1px difference), the test passed. And when the height was exactly 200, the
medium image size was hit exactly. The failure occurred only with a height of
201, which is close enough to 200 so that WP determined that the aspect ratio
of the potential crop was close enough to match.

The current changeset splits the test into two, in order to demonstrate the
failure.

See #17626. Fixes #34087.

git-svn-id: https://develop.svn.wordpress.org/trunk@34775 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 14:13:15 +00:00
Boone Gorges 991feb7043 Pinking shears in shortcode test file.
git-svn-id: https://develop.svn.wordpress.org/trunk@34774 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:18 +00:00
Boone Gorges f408407620 Improvements to PCRE benchmarking tests.
* Add test file accidentally omitted from [34761].
* Bail properly from benchmarker when a `preg_last_error()` is found.

Props miqrogroove.
See #34121.

git-svn-id: https://develop.svn.wordpress.org/trunk@34773 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:12 +00:00
Boone Gorges 19df309491 Fix `preg_match_all()` syntax in PCRE benchmark test util.
In versions of PHP earlier than 5.4, the `$matches` parameter was required.
Excluding it here meant that PCRE benchmarking tests were erroring on older
versions of PHP without cleaning up the PCRE ini settings, causing various
problems on later tests.

Props miqrogroove, dd32, boonebgorges.

And to the cosmic forces that cause bugs like this. The best part of waking up
is diagnosing leakage between automated tests.

See #34121.

git-svn-id: https://develop.svn.wordpress.org/trunk@34772 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 13:50:04 +00:00
Dion Hulse b20695ed9f Skip two `wp_json_encode()` tests when mbstring is unavailable.
git-svn-id: https://develop.svn.wordpress.org/trunk@34771 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 08:54:52 +00:00
Scott Taylor 79dc7efc73 Unit Tests: when `wp_using_ext_object_cache()`, mark some transient tests as skipped.
Props ocean90.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34767 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:09:03 +00:00
Scott Taylor c6571bcfad Unit Tests: tests that want to flush the cache should use their instance method instead of calling `wp_cache_flush()` - more properties need to be wiped out in between tests.
Props ocean90.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34766 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:08:13 +00:00
Scott Taylor cae64c5e13 Unit Tests: in `Tests_Cache::test_wp_cache_init()`, when `wp_using_ext_object_cache()`, just check that the global is an instance of `WP_Object_Cache`. External object cache instances of `WP_Object_Cache` will contain resources as props that will always have differing internal IDs, so strict comparison won't work.
See #31491.


git-svn-id: https://develop.svn.wordpress.org/trunk@34765 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 05:05:26 +00:00
Scott Taylor a31e54344c Posts: In `wp_insert_post()`, don't set `post_date` to current time if it can be derived from a passed value for `post_date_gmt`.
Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.


git-svn-id: https://develop.svn.wordpress.org/trunk@34762 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:35:34 +00:00
Scott Taylor 5a24a0a4f8 Shortcodes/Formatting: Add PCRE Performance Testing
* Move pattern from `wptexturize()` into a separate function.
* Move pattern from `wp_html_split()` into a separate function.
* Beautify code for `wp_html_split()`.
* Remove unnecessary instances of `/s` modifier in patterns that don't use dots.
* Add `tests/phpunit/data/formatting/whole-posts.php` for testing larger strings.
* Add function `benchmark_pcre_backtracking()`.
* Add tests for `wp_html_split()`.
* Add tests for `wptexturize()`.
* Add tests for `get_shortcode_regex()`.

Props miqrogroove.
Fixes #34121.


git-svn-id: https://develop.svn.wordpress.org/trunk@34761 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 04:25:40 +00:00
Jeremy Felt 319818a408 Tests: Clarify site option tests storing and retrieving serialized data.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34759 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 02:05:23 +00:00
Jeremy Felt b9e1b4ab7c Tests: Split `test_default_filter()` Site Option test into multiple tests.
See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34758 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 01:55:52 +00:00
Jeremy Felt e261546a61 Tests: Split `test_the_basics()` Site Option test into many tests.
Many assertions in one test are now many tests with one assertion.

See #28290.


git-svn-id: https://develop.svn.wordpress.org/trunk@34757 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-02 01:32:09 +00:00
Scott Taylor e0b34f44a3 Shortcodes: Fix PCRE performance bugs in `get_shortcode_regexp()` and related to `wptexturize()`, `do_shortcode()`, and `strip_shortcodes()`
Alters unit tests.

Props miqrogroove.
Fixes #33517.


git-svn-id: https://develop.svn.wordpress.org/trunk@34747 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 18:04:13 +00:00
Scott Taylor 1b70f27b04 Shortcodes: prevent registration of invalid shortcode names.
Adds unit tests.

Props miqrogroove.
Fixes #34090.


git-svn-id: https://develop.svn.wordpress.org/trunk@34745 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 17:33:58 +00:00
Boone Gorges 2828042b6e Make sure permastruct is set in `comments_template()` tests.
After [34735].

git-svn-id: https://develop.svn.wordpress.org/trunk@34741 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 12:26:33 +00:00
Gary Pendergast f9f56fb942 WPDB: Allow `null` values in the CRUD functions.
Specifically, `::insert()`, `::replace()`, `::update()`, and `::delete()` can now set a column to `NULL`, or add the `IS NULL` condition to the `WHERE` clause.

This is based on [backpress 279].

Props pento, nbachiyski, sorich87.

Fixes #15158.



git-svn-id: https://develop.svn.wordpress.org/trunk@34737 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:36:15 +00:00
Boone Gorges ee2c079ade Ensure that comment permalinks reflect pagination.
After [34561], `wp_list_comments()` no longer passed all of a post's comments
to `Walker_Comments`. As a result, calls to `get_comment_link()` occurring
inside the comment loop had insufficient context to determine the proper
'cpage' value to use when generating comment permalinks. This, in turn, caused
comment permalinks to behave erratically.

The current changeset addresses the problem as follows:

* `get_comment_link()` now accepts a 'cpage' parameter. When present, 'cpage' will be used to build the comment permalink - no automatic calculation will take place.
* When called within the main loop, `wp_list_comments()` calculates the proper 'cpage' value for comments in the loop, and passes it down to `get_comment_link()`.
* `cpage` and `comment-page-x` query vars are generally required in comment permalinks (see #34068), but an exception is made when 'default_comment_page=oldest': the bare post permalink will always be the same as `cpage=1`, so `cpage` is excluded in this case.

Props peterwilsoncc for assiduous spreadsheeting.
Fixes #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34735 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 05:12:39 +00:00
Boone Gorges f14dc03ad6 Simplify pagination logic in `comments_template()`.
[34561] "fixed" the problem of newest-first comments showing fewer than
'per_page' comments on the post permalink when the total number of comments
was not divisible by 'per_page'. See #29462. But this fix caused numerous
other problems. First, comment pages reported by `get_page_of_comment()`
(which expects comment pages to be filled oldest-first) were no longer correct.
Second, and more seriously, the new logic caused comments to be shifted
between pages, making their permalinks non-permanent.

The current changeset reverts the changed behavior. In order to preserve the
performance improvements introduced in [34561], an additional query must be
performed when 'default_comments_page=newest' and 'cpage=0' (ie, you're viewing
the post permalink). A nice side effect of this revert is that we no longer
need the hacks required to determine proper comment pagination, introduced in
[34561].

See #8071. See #34073.

git-svn-id: https://develop.svn.wordpress.org/trunk@34729 602fd350-edb4-49c9-b593-d223f7449a82
2015-10-01 03:10:13 +00:00
Boone Gorges 9dd6f369cf Fix db_version juggling during non-multisite tests.
Continuing with the "code is poetry" theme after [34719], we need to continue
to update the option in the database on non-multisite in this
`wp_insert_term()` test.

See #31130.

git-svn-id: https://develop.svn.wordpress.org/trunk@34720 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 13:27:09 +00:00
Boone Gorges 13e28a6d34 Prevent Multisite term tests from hitting database for 'db_version'.
[34718] introduced a 'db_version' check to term meta functions, to ensure that
they don't run when the term meta schema is not yet in place. This call to
`get_option()` causes a database hit during Multisite tests, due to the
presence of the `WP_INSTALLING` constant. See #31130. The extra database
queries are causing cache tests to fail.

In similar cases, we have `markTestSkipped()` when `is_multisite()`. Because
the term meta API is so extensive - term meta caches can be primed anywhere a
`WP_Query` loop is fired up - we implement a more generous workaround in this
case. To prevent `get_option( 'db_version' )` from hitting the database during
multisite unit tests, we use a 'pre_option_' filter.

Heaven help us.

See #34091.

git-svn-id: https://develop.svn.wordpress.org/trunk@34719 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 13:08:49 +00:00
Boone Gorges 30a165a1a5 Fix logical errors in some comment pagination tests.
The tests included in [34669] contained a couple of problems:

* Comments were not always created in the expected order, due to the incorrect use of 'comment_date_gmt'.
* 'asc'/'desc' and 'older'/'newer' were confused.
* 'default_comments_page=newest' ('last') didn't properly account for the cpage=1 offset.

The code itself powering this pagination was correct; it's only the tests that
were wrong.

See #8071.

git-svn-id: https://develop.svn.wordpress.org/trunk@34713 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 03:06:22 +00:00
Boone Gorges 283c38c022 Improve lazyloading of comment meta in `WP_Query` loops.
Lazy-loading logic is moved to a method on `WP_Query`. This makes it possible
for comment feeds to take advantage of metadata lazyloading, in addition to
comments loaded via `comments_template()`.

This new technique parallels the termmeta lazyloading technique introduced in
[34704].

Fixes #34047.

git-svn-id: https://develop.svn.wordpress.org/trunk@34711 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 01:34:54 +00:00
Scott Taylor 427f4fe063 Rewrite: allow `add_rewrite_rule|WP_Rewrite::add_rule()` to accept an associative array for the value of `$redirect` instead of requiring a query string.
Adds unit tests.

Props scribu, DrewAPicture.
Fixes #16840.


git-svn-id: https://develop.svn.wordpress.org/trunk@34708 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-30 01:10:03 +00:00
Boone Gorges e75f2c024f Improve lazyloading of term metadata in `WP_Query` loops.
[34529] introduced lazyloading for the metadata belonging to terms matching
posts in the main `WP_Query`. The current changeset improves this technique
in the following ways:

* Term meta lazyloading is now performed on the results of all `WP_Query` queries, not just the main query.
* Fewer global variable touches and greater encapsulation.
* The logic for looping through posts to identify terms is now only performed once per `WP_Query`.

Props dlh, boonebgorges.
See #34047.

git-svn-id: https://develop.svn.wordpress.org/trunk@34704 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 21:59:44 +00:00
John Blackbourn 601ace8b25 `force_ssl_login()` has been functionally identical to `force_ssl_admin()` since 4.0 (#10267), so its test assertions can be removed as the function has been deprecated in [34700]. The remaining assertions suitably cover `force_ssl_admin()`.
See #34011


git-svn-id: https://develop.svn.wordpress.org/trunk@34703 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 21:43:04 +00:00
Drew Jaynes c226bff80b Tests: Add two tests for the current behavior of the 'hierarchical' and 'child_of' arguments in `get_pages()`.
See #18701.


git-svn-id: https://develop.svn.wordpress.org/trunk@34699 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 21:27:03 +00:00
Drew Jaynes 49f4196f12 Tests: Add two tests for the current 'hierarchical' argument behavior in `get_pages()`.
See #18701.


git-svn-id: https://develop.svn.wordpress.org/trunk@34698 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 20:49:32 +00:00
Boone Gorges 49063d8e14 `WP_Query` should not ignore an offset of `0`.
Props mazurstas.
Fixes #34060.

git-svn-id: https://develop.svn.wordpress.org/trunk@34697 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 19:36:16 +00:00
Boone Gorges 3b7187eade Fix 'exclude_tree' in `wp_list_categories()`.
The 'exclude_tree' parameter must be compatible with 'hierarchical';
previously, 'hierarchical' canceled it out. This changeset also makes it so
that 'exclude_tree' is compatible with 'exclude'. When both are passed, and
'hierarchical' is true, the descendant trees of terms in both parameters will
be excluded from matched terms.

Props tott, webord, MikeHansenMe.
Fixes #12981.

git-svn-id: https://develop.svn.wordpress.org/trunk@34696 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 19:11:12 +00:00
Aaron Jorbin f765605336 Cleanup image size in unit tests
This helps prevent test leakage that can cause Tests_Media::test_add_image_size to break.

See #33968



git-svn-id: https://develop.svn.wordpress.org/trunk@34694 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 17:47:24 +00:00
Gary Pendergast ce14a63214 Permalinks: Add pretty permalinks for unattached attachments.
Previously, unattached attachments would have unsightly `/?attachment_id=1` URLs. As we've moved away from attachments being specifically attached to posts, instead being Media items, this has made the unattached URLs a more common occurrence.

We can breath easy once more, knowing that the world is a little bit safer from the horror of unnecessarily ugly URLs.

Props SergeyBiryukov, wonderboymusic, pento.

Fixes #1914.



git-svn-id: https://develop.svn.wordpress.org/trunk@34690 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 09:41:14 +00:00
Drew Jaynes f270e7a03e Tests: Relocate tests for general-template.php to a more logically-placed (and named) file, tests/general/template.php.
See #34070.


git-svn-id: https://develop.svn.wordpress.org/trunk@34688 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 05:51:14 +00:00
Drew Jaynes 6f6f62b6e5 Tests: Consolidate author-template tests into a single, more logically-placed file, tests/user/author.php.
See #34070.


git-svn-id: https://develop.svn.wordpress.org/trunk@34687 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 05:37:00 +00:00
Scott Taylor 1ac3ba0828 Allow `wp_get_archives()` to accept `post_type` as an arg.
Adds unit test.

Fixes #21596.


git-svn-id: https://develop.svn.wordpress.org/trunk@34686 602fd350-edb4-49c9-b593-d223f7449a82
2015-09-29 05:10:10 +00:00