Commit Graph

675 Commits

Author SHA1 Message Date
Boone Gorges f7dbf962d7 Only reset taxonomies and post types between tests when running core tests.
A growing number of plugins and other WP-based projects use the core test
tools, such as WP_UnitTestCase, as the basis of their own tests and continuous
integration setups. At the same time, many of these third-party plugins use
custom post types and taxonomies, which are generally registered a single time
during a run of the tests: at 'init', before the testcases have run. Wiping out
these globals between tests will mess with these third-party builds.

Best practice for plugin developers is probably to clean up their own post types
and taxonomies and then reinitialize before each test. But, in the interest of
not breaking everyone's builds, the core test suite will not enforce this.

Fixes #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29869 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-10 20:25:39 +00:00
Boone Gorges bce6d64d59 Return an error when adding a term to a non-existent parent.
Parallels the logic of wp_insert_term(), introduced in [29196].

Props jesin.
Fixes #29614.

git-svn-id: https://develop.svn.wordpress.org/trunk@29867 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 18:11:17 +00:00
Boone Gorges adbed947d8 Don't bail out of term_exists() when term sanitizes to an empty string.
This change brings return values for failures of this sort in line with other
failed lookups in term_exists(): a null value is now returned in all cases
where the queried term is not found.

Adds unit test for the sanitization issue. Modifies existing unit test to
reflect the change in return value for empty term strings.

Props boonebgorges, georgestephanis.
Fixes #29589.

git-svn-id: https://develop.svn.wordpress.org/trunk@29865 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 03:15:50 +00:00
Dion Hulse 8ff133f232 Add some unit tests for WP_HTTP::parse_url() to cover the <PHP 5.4.7 compatibility alterations.
These unit tests cover the expected vehaviour of certain combinations of URL's, but makes no attempt to test invalid URL structures, as PHP's behavious for invalid URL's is undefined (Some will be treated as paths, others fail, and it varies between PHP 5.4.7+ and <5.4.7).
This change also makes WP_HTTP::parse_url() protected in order to allow unit testing.
See #28001, #29886


git-svn-id: https://develop.svn.wordpress.org/trunk@29864 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 03:00:16 +00:00
Boone Gorges 568b43f242 Fix term_exists() for parent = 0.
Passing a 0 (or '0') as the 'parent' param of term_exists() should limit
results to terms with no parent.

Adds unit test.

Fixes #29851.

git-svn-id: https://develop.svn.wordpress.org/trunk@29863 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 02:48:47 +00:00
Boone Gorges 01c529e062 Improve 'alias_of' handling in wp_insert_term() and wp_update_term().
Using get_term_by() rather than direct SQL queries to fetch the alias term
fixes a number of issues:

* Object cache for aliased term is properly cleared after update.
* If the aliased term is in the object cache, it's served from there, saving a database query.
* Duplicate 'edit_terms' and 'edited_terms' hooks can be removed.
* Fix a PHP notice when the 'alias_of' term is not found.
* Prevent the incorrect creation of a new term group for the primary term when the 'alias_of' term is not found.

Adds unit tests for 'alias_of' functionality in both functions.

Fixes #29848.

git-svn-id: https://develop.svn.wordpress.org/trunk@29862 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 02:31:35 +00:00
Boone Gorges 5e7be10860 Reset post types and taxonomies before each unit test.
Registering a post type or taxonomy during a unit test causes modifications to
global variables. If the test fails to clean up these globals - either by
neglecting to call _unregister_post_type()/_unregister_taxonomy() at all or by
failing before getting a chance to do so - tests that run later in the suite
can fail, leading to much gnashing of teeth. Wiping all taxonomies and
restoring to the defaults before each test ensures that we always start with a
clean slate.

Fixes #29827.

git-svn-id: https://develop.svn.wordpress.org/trunk@29860 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-09 00:57:26 +00:00
Aaron Jorbin 3bfa930580 Change assertEqual to assertEqualSets since the order that travis-ci creates posts isn't consistent
see #29718



git-svn-id: https://develop.svn.wordpress.org/trunk@29857 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 19:21:30 +00:00
Konstantin Kovshenin 061fe13c9f Use the primary `meta_query` clause when parsing `orderby` in `WP_Query`.
When using legacy `meta_key`, `meta_value`, etc. arguments in `WP_Query`,
they're converted into the first clause of a `meta_query`. By using that
clause instead of the original arguments, we make sure that behavior is
consistent between the two available formats.

props boonebgorges.
fixes #16814.


git-svn-id: https://develop.svn.wordpress.org/trunk@29855 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 15:11:14 +00:00
Konstantin Kovshenin 6eea081457 New `remove()` method and some unit tests for the `WP_Error` class.
props stephenharris.
fixes #28092.


git-svn-id: https://develop.svn.wordpress.org/trunk@29854 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 07:11:09 +00:00
Dion Hulse 4ae1397f96 Correctly support Schemeless URLs in WP_HTTP::make_absolute_url() by respecting the 'host' field if present in the relative url.
Fixes #29886


git-svn-id: https://develop.svn.wordpress.org/trunk@29851 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 05:57:15 +00:00
Dion Hulse e4268adfde Correctly handle url's containing url's in WP_HTTP::make_absolute_url().
A valid relative URL could be mistaken for an absolute url if it contained a :// in any position of the url.
Fixes #28001


git-svn-id: https://develop.svn.wordpress.org/trunk@29850 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-08 05:37:56 +00:00
Boone Gorges e79c2e0c9e In get_terms(), select term taxonomy count for all values of 'fields'.
Not having the count caused queries with 'fields' values of 'id=>name' and
'id=>slug' to return incorrect results when querying a hierarchical taxonomy
with 'hide_empty=true'.

Includes unit tests for get_terms() when using various combinations of 'fields',
'hide_empty', and 'hierarchical' arguments.

Props technical_mastermind.
Fixes #29859.

git-svn-id: https://develop.svn.wordpress.org/trunk@29845 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-06 22:04:11 +00:00
Sergey Biryukov 1a7c4efa13 Fix setting default quality in WP_Image_Editor.
props markoheijnen.
fixes #29856 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29834 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-04 13:11:38 +00:00
Boone Gorges ecac4d4a94 Improve unit test coverage for wp_insert_term().
See #5809, #22023.

git-svn-id: https://develop.svn.wordpress.org/trunk@29830 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-03 13:30:22 +00:00
Sergey Biryukov 569a80e488 Add unit tests for get_blog_details().
props jeremyfelt.
fixes #29845.

git-svn-id: https://develop.svn.wordpress.org/trunk@29824 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 21:47:25 +00:00
Boone Gorges 6ffb0fcafb Always sanitize user_nicename in wp_insert_user().
Previously, a 'user_nicename' parameter passed into the function was
unsanitized. This could result in a mismatch between the sanitized nicename
generated automatically at user creation, resulting in broken author archive
permalinks.

Props joemcgill.

Fixes #29696.

git-svn-id: https://develop.svn.wordpress.org/trunk@29819 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 18:53:24 +00:00
Scott Taylor dcef5d4583 In `activate_plugin()`, do not re-run the activation routine for already-active network-wide plugins.
Adds unit test.

Props jbrinley.
Fixes #28651.


git-svn-id: https://develop.svn.wordpress.org/trunk@29818 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 15:55:51 +00:00
Boone Gorges dd9e9501c1 WP_Comment_Query: comment__in, comment__not_in, post__in, post__not_in.
Props nofearinc, mordauk, boonebgorges

Fixes #25386

git-svn-id: https://develop.svn.wordpress.org/trunk@29808 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 01:40:56 +00:00
Boone Gorges 6dc662431a Improve unit tests for WP_Tax_Query.
* Exhaustive tests for publicly available functionality of WP_Tax_Query.
* For tests that are related to the tax_query argument as used in WP_Query, move to tests/post/query.php.
* Add some tax_query tests to cover single vs multiple queries using AND and OR; various values for 'field'; various values for 'operator'.
* Improve test names.
* Correct @group annotations.
* Improve performance of some WP_Query-related tests by declaring 'update_post_meta/term_cache' false.

Fixes #29718

git-svn-id: https://develop.svn.wordpress.org/trunk@29805 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-02 01:07:20 +00:00
Boone Gorges 1f6fd2c926 Improve unit tests related to WP_Meta_Query.
* More complete test coverage for publicly available methods of WP_Meta_Query.
* Move tests that rely on WP_Query (via the meta_query parameter) to tests/post/query.php.
* Better coverage for basic use cases of 'meta_query', including all values of 'compare' and default values of 'key', 'value', and 'compare'.
* Improve performance for tests that run WP_Query, by retrieving only post IDs and not prefetching postmeta and post terms.
* Add 'public' visibility keywords to test methods.
* Whitespace cleanup.

Fixes #29560

git-svn-id: https://develop.svn.wordpress.org/trunk@29799 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 21:17:38 +00:00
Boone Gorges 0b80b40d59 Improve unit test coverage for duplicate term creation.
These include an exhaustive set of tests for term_exists(), as well as tests
for wp_insert_term() that demonstrate failure when attempting to create a
duplicate term.

Props simonwheatley for an initial patch.

See #22023.


git-svn-id: https://develop.svn.wordpress.org/trunk@29798 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 14:59:10 +00:00
Boone Gorges 780c6962e5 Improve parameter sanitization in WP_Date_Query::build_query().
* Don't run non-numeric values through intval() for sanitization; this transforms them into 1s and 0s, which can cause unintended results.
* Be more generous about numeric array keys (don't require 0 and 1) in BETWEEN and NOT BETWEEN clauses.

Fixes #29801.

git-svn-id: https://develop.svn.wordpress.org/trunk@29797 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-30 14:03:49 +00:00
Boone Gorges 5a288bad58 Fix file location for WP_Date_Query tests introduced in r29793.
See #29781


git-svn-id: https://develop.svn.wordpress.org/trunk@29794 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 16:19:53 +00:00
Boone Gorges fd816091a5 Improved unit test coverage for WP_Date_Query
- Unit tests for all publicly available functionality in WP_Date_Query
- Improve performance of date_query tests that use WP_Query

Fixes #29781


git-svn-id: https://develop.svn.wordpress.org/trunk@29793 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 16:04:46 +00:00
Sergey Biryukov f6753a316a Change the default orderby value in wp_get_nav_menus() to 'name'.
props voldemortensen, igmoweb.
fixes #29460.

git-svn-id: https://develop.svn.wordpress.org/trunk@29792 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 15:44:26 +00:00
Mark Jaquith be8a0c6f89 Use HTTPS URLs for trac.wordpress.org (and use core.trac.wordpress.org)
see #27115

git-svn-id: https://develop.svn.wordpress.org/trunk@29789 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 13:36:38 +00:00
Mark Jaquith 7063377539 Use HTTPS URLs for core.trac.wordpress.org
see #27115

git-svn-id: https://develop.svn.wordpress.org/trunk@29788 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 13:27:55 +00:00
Scott Taylor 23f7f53be2 The joys of `wptexturize()`:
* Revert parts of [28773] and [28727] and [29748].
* Do not crash PHP. Make the shortcode quantifier possessive to avoid backtracks.
* Reduce backtracking in long HTML comments by 100x.
* Do not ignore unclosed HTML comments.
* Do not break unregistered shortcodes, e.g. `[hello attr="value"]`.
* Do not break HTML in shortcode attributes, e.g. `[hello attr="<"]`.
* Do not match for shortcodes when there is extra whitespace, e.g. `[ hello ]`.
* Add unit tests to show #12690 was not fully resolved.
* Tested PHP 5.2.4, 5.2.13, 5.4.32, and 5.5.8.

Adds/modifies unit tests.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29781 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 04:06:54 +00:00
Scott Taylor 18adbb6439 In `paginate_links()`, ensure that query string args are propagated to the resulting paginated links.
Adds unit tests that use `DOMDocument` since `assertTag` is being deprecated - see #29545, [29746].

Props obenland, wonderboymusic.
Fixes #29636.


git-svn-id: https://develop.svn.wordpress.org/trunk@29780 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-29 04:02:23 +00:00
Sergey Biryukov 3226d8b867 Create correct permalinks for child posts of hierarchical post types when default permalinks are used.
props loushou.
fixes #29615 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29765 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-24 21:29:15 +00:00
Scott Taylor 0b0eb4fb20 Ordering by `RAND()`:
The shortcode callbacks for `gallery` and `playlist` check for `'RAND' == $atts['order']`, which isn't a valid value for `order`. Remove those checks and update the docs.

In `WP_Query`, if the value of `orderby` is `rand`, `order` is irrelevant and should be unset.

Adds unit tests.

Fixes #29629.


git-svn-id: https://develop.svn.wordpress.org/trunk@29760 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-23 03:51:24 +00:00
Scott Taylor f00f28cce0 `wp_extract_urls()` needs to also grab URLs with query strings and hashes.
Updates unit test.

Props hauvong, dlh.
Fixes #29314.


git-svn-id: https://develop.svn.wordpress.org/trunk@29756 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-23 02:49:22 +00:00
Scott Taylor 606cd967f6 `wptexturize()` improvements:
* Expand the `wptexturize()` RegEx to include the list of registered shortcodes.
* Avoid backtracking after `[` chars by not filtering params in registered shortcodes. This will cause escaped shortcodes and their params to become texturized if not registered.
* Registered shortcode params will never be texturized, even when escaped.
* Move all tests involving unregistered shortcodes to a new and improved unit.
* Update one test involving HTML within shortcode params.

Props miqrogroove.
See #29557.


git-svn-id: https://develop.svn.wordpress.org/trunk@29748 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-17 15:13:24 +00:00
Scott Taylor fbf974a962 After [29200] and [29250], `Tests_MS::test_multisite_bootstrap()` should no longer have the `@expectedDeprecated` annotation.
git-svn-id: https://develop.svn.wordpress.org/trunk@29747 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 18:05:06 +00:00
Scott Taylor fd0b0d5f4f `assertTag()` has been deprecated in PHPUnit 4.2. Rewrite some of the tests in `Tests_Paginate_Links` to use `DOMDocument`.
Props effstieler.
Fixes #29545.


git-svn-id: https://develop.svn.wordpress.org/trunk@29746 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 17:41:47 +00:00
Sergey Biryukov 6e0ca0d8d9 Make sure the $parent argument of wp_insert_attachment() still works as expected after [28579].
prop jesin, dikiy_forester.
fixes #29646 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@29745 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-15 14:23:31 +00:00
Sergey Biryukov 445b364f5b Properly suppress errors in test_empty_where_on_update(), which expects an empty WHERE clause.
see #26106.

git-svn-id: https://develop.svn.wordpress.org/trunk@29701 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-04 04:30:11 +00:00
Andrew Nacin d8b80c3254 Unit tests for has_filter() not resetting the array pointer.
props pento.
fixes #29070. see [29472].


git-svn-id: https://develop.svn.wordpress.org/trunk@29665 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-02 06:49:11 +00:00
Andrew Nacin 1cde8312b6 DB: Revert [28814] and require a WHERE for wpdb::update().
see #26106.


git-svn-id: https://develop.svn.wordpress.org/trunk@29664 602fd350-edb4-49c9-b593-d223f7449a82
2014-09-02 04:55:17 +00:00
Andrew Nacin 7c145e0bd9 Meta Query: Revert [28659] (and [28665]) due to regressions.
props boonebgorges.
fixes #29285. see #25538.


git-svn-id: https://develop.svn.wordpress.org/trunk@29650 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-27 20:22:35 +00:00
Andrew Nacin e3345398aa Rename the public methods in the session tokens API.
Introduces a new get( $token ) method. get_token() would not have made sense and spurred the overall renaming. Public methods are now get, get_all, verify, create, update, destroy, destroy_others, and destroy_all.

The protected abstract methods designed for alternative implementations remain the same.

props mdawaffe.
see #20276.


git-svn-id: https://develop.svn.wordpress.org/trunk@29635 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-27 02:06:53 +00:00
Andrew Nacin bf0272c8b1 Require a non-empty $nonce value in wp_verify_nonce().
props ocean90.
fixes #29217.


git-svn-id: https://develop.svn.wordpress.org/trunk@29620 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-26 07:38:51 +00:00
Andrew Ozz c83a9ca2c9 TinyMCE: update to 4.1.4-20140822. Changes:
- Fixed bug where sometimes the resize rectangles wouldn't properly render on images on WebKit/Blink. 9a2d01cc14
- Fixed nodeChanged selection issue where the image selection wouldn't be removed if you clicked right after/before it. dd729c67e0
- Fixed bug in list plugin where delete/backspace would merge empty LI elements in lists incorrectly. caadfb05dd
See #29310

git-svn-id: https://develop.svn.wordpress.org/trunk@29576 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-22 17:43:39 +00:00
Andrew Ozz 208645191d TinyMCE: update to 4.1.4. Changelog: http://www.tinymce.com/develop/changelog/?type=tinymce. Fixes #29310
git-svn-id: https://develop.svn.wordpress.org/trunk@29570 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-21 23:52:28 +00:00
Scott Taylor 89ed2c4217 Ensure that `$wpdb` is imported in `Tests_MS::_setup_host_request`.
Props tellyworth.
Fixes #27884.


git-svn-id: https://develop.svn.wordpress.org/trunk@29552 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-20 17:13:04 +00:00
Dominik Schilling (ocean90) 1ba2f5c853 Fix expected value in `Tests_Media::test_video_shortcode_body()`.
Since [29457] the `.wp-video` wrapper for a video has a height set.

fixes #29110.

git-svn-id: https://develop.svn.wordpress.org/trunk@29515 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-17 11:48:03 +00:00
Sergey Biryukov 262929004d Avoid undefined index notices in WP_UnitTestCase::_restore_hooks().
props kevinlangleyjr.
fixes #29123.

git-svn-id: https://develop.svn.wordpress.org/trunk@29503 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-15 15:40:48 +00:00
Andrew Ozz f8fed596ec TinyMCE: update to 4.1.3, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt, fixes #29166
git-svn-id: https://develop.svn.wordpress.org/trunk@29458 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-09 20:55:34 +00:00
Scott Taylor 06eea1b33d After [28883], ensure that priorities have callbacks before returning `true` in `has_filter()`.
Adds unit tests.

Props boonebgorges.
Fixes #29070.


git-svn-id: https://develop.svn.wordpress.org/trunk@29422 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-07 02:29:15 +00:00
Scott Taylor e9ba499f23 After [29339] and [29341], add more unit tests and less ambiguous type-checking before bailing in meta-related functions that expect a numeric value for `$object_id`.
Props SergeyBiryukov.
Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29421 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-06 22:07:42 +00:00
Sergey Biryukov 1cc1956a1f Consolidate some of the test functions added in [29344].
see #28310.

git-svn-id: https://develop.svn.wordpress.org/trunk@29351 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 21:06:49 +00:00
Scott Taylor 7374913866 Add unit tests for `Walker` class.
Props willmot.
See #15667.


git-svn-id: https://develop.svn.wordpress.org/trunk@29347 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 20:35:25 +00:00
Scott Taylor 91517ce620 Clarify that `get_the_date()`, `get_the_time()`, `get_post_time()` and `get_post_modified_time()` should return `false` when `get_post()` is `null`.
Adds unit tests.

Props GaryJ, SergeyBiryukov, tollmanz.
Fixes #28310.


git-svn-id: https://develop.svn.wordpress.org/trunk@29344 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:39:22 +00:00
Scott Taylor 0ee7c9c678 Update unit tests for `sanitize_file_name()` after [29290].
git-svn-id: https://develop.svn.wordpress.org/trunk@29342 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:29:46 +00:00
Scott Taylor 7677eb2f8e Account for `WP_IMPORTING` being defined in the unit tests added in [29339] when all tests are run.
Glory, glory hallelujah.

Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29341 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 18:27:16 +00:00
Scott Taylor 5686f4511a Bail on `update_user_meta()` when `$object_id` is non-numeric.
Adds unit test.

Props jacklenox, wonderboymusic.
Fixes #28315.


git-svn-id: https://develop.svn.wordpress.org/trunk@29339 602fd350-edb4-49c9-b593-d223f7449a82
2014-08-01 17:09:53 +00:00
Andrew Ozz 23d876d86a Tests Autop: remove <option> from the list of inline tags. It is valid only in specific context (<select>, <optgroup> or <datalist>) and should not be wrapped in <p>. Props kovshenin, fixes #28217.
git-svn-id: https://develop.svn.wordpress.org/trunk@29328 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-29 19:02:36 +00:00
Dominik Schilling (ocean90) 0f93a72879 Remove unit test for `is_https_url()`, see [29309].
see #28487.

git-svn-id: https://develop.svn.wordpress.org/trunk@29310 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-27 17:18:19 +00:00
Scott Taylor 1cbe1cec12 In `sanitize_file_name()`, replace `%20` and `+` with dashes. Remove unnecessary code from `_wp_handle_upload()`.
Adds unit tests.

Props ericmann.
Fixes #16330.


git-svn-id: https://develop.svn.wordpress.org/trunk@29290 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-24 22:08:09 +00:00
Helen Hou-Sandi c72d29e63e Revert [29267], as it causes unit test breakage and appears unnecessary. see #28986.
git-svn-id: https://develop.svn.wordpress.org/trunk@29274 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-23 02:22:57 +00:00
Scott Taylor 7f9edd3e69 After [29251], set the array keys in `WP_UnitTestCase::$hooks_saved` to prevent notices in 3rd party use cases.
Props danielbachhuber.
Fixes #28986.



git-svn-id: https://develop.svn.wordpress.org/trunk@29267 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-22 17:21:40 +00:00
Scott Taylor 77ee35c4eb `wp_script_is( ..., 'enqueued' )` needs to check dependencies recursively - a single item's dependencies may only be a subset of the full dependency tree. Adds a new method on `WP_Dependencies` called `->recurse_deps()`.
Adds unit test.

Props wonderboymusic, SergeyBiryukov, mikejolley.
Fixes #28404.


git-svn-id: https://develop.svn.wordpress.org/trunk@29252 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-20 00:28:57 +00:00
Scott Taylor 36e455d018 Backup filter globals ( `$merged_filters, $wp_actions, $wp_current_filter, $wp_filter` ) statically when running unit tests, restore on `tearDown()`. This ensures that all tests initially use the same filters/actions.
Props mnelson4, wonderboymusic.
Fixes #28535.


git-svn-id: https://develop.svn.wordpress.org/trunk@29251 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-19 23:58:07 +00:00
Scott Taylor ca5d586b8e After [29200], switch back to using `static` vars instead of adding 2 `global`s, as per Sergey.
Fixes #28697.


git-svn-id: https://develop.svn.wordpress.org/trunk@29250 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-19 23:13:19 +00:00
Scott Taylor a1aa518788 Call `untrailingslashit()` when adding a theme directory in `register_theme_directory()`. This prevents double-slashing in generated URLs. Don't add a directory if it is already present.
Adds unit tests.
Props obenland, wonderboymusic.
Fixes #28662.


git-svn-id: https://develop.svn.wordpress.org/trunk@29249 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-19 23:06:54 +00:00
Scott Taylor 150e1367b4 In `get_adjacent_post()`, make `$excluded_terms` work as expected.
Adds unit tests.
Props jessepollak, kovshenin.
Fixes #22112.


git-svn-id: https://develop.svn.wordpress.org/trunk@29248 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-19 22:26:43 +00:00
Andrew Nacin 97fcbef707 Tie cookies and nonces to user sessions so they may be invalidated upon logout.
Sessions are stored in usermeta via WP_User_Meta_Session_Tokens, which extends the abstract WP_Session_Tokens class. Extending WP_Session_Tokens can allow for alternative storage, such as a separate table or Redis.

Introduces some simple APIs for session listing and destruction, such as wp_get_active_sessions() and wp_destroy_all_sessions().

This invalidates all existing authentication cookies, as a new segment (the session token) has been added to them.

props duck_, nacin, mdawaffe.
see #20276.


git-svn-id: https://develop.svn.wordpress.org/trunk@29221 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-18 09:12:05 +00:00
Andrew Ozz db9a148b34 TinyMCE:
- Update to 4.1.2, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt
- Update the tests to 4.1.2.
Fixes #28576.

git-svn-id: https://develop.svn.wordpress.org/trunk@29203 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-17 00:58:41 +00:00
Scott Taylor bda6f0cffe Properly set `$subdomain_error` to `false` when applicable in `ms_subdomain_constants()`. This was previously untestable because it used static vars: use globals instead.
Adds unit test.
Fixes #28697.


git-svn-id: https://develop.svn.wordpress.org/trunk@29200 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-16 22:34:18 +00:00
Scott Taylor 17d67d93e7 Make `has_shortcode()` recursive/work for nested shortcodes.
Adds unit test.

Props katzwebdesign.
Fixes #26343.


git-svn-id: https://develop.svn.wordpress.org/trunk@29197 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-16 22:04:08 +00:00
Scott Taylor 722930611c Avoid a race condition when multiple windows are open so that orphaned terms cannot be created by accident.
Adds a unit test.

Props dlh.
Fixes #19205.


git-svn-id: https://develop.svn.wordpress.org/trunk@29196 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-16 21:51:40 +00:00
Sergey Biryukov 092e51042c Use assertEqualSets() instead of direct array comparison.
see #28434.

git-svn-id: https://develop.svn.wordpress.org/trunk@29134 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-13 11:27:07 +00:00
Scott Taylor d97b10eecf Wouldn't it be incredible if you could run Unit Tests without all of your uploads being indiscriminately blown away and your upload folder permissions being destroyed?
The Future Is Now.

Fixes #28847.


git-svn-id: https://develop.svn.wordpress.org/trunk@29120 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-12 07:08:15 +00:00
Peter Westwood 52aa1804e4 XMLRPC: Restore support in wp.newPost for dates to be supplied in the structured dateTime.iso8601 format as well as still supporting dates specified as strings.
Fixes #28601.


git-svn-id: https://develop.svn.wordpress.org/trunk@29063 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-10 14:16:20 +00:00
Peter Westwood c89afd5a59 XMLRPC: Extend the test cases from [28854] so that we also test valid date based strings. See #28601.
git-svn-id: https://develop.svn.wordpress.org/trunk@29062 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-10 14:05:22 +00:00
Peter Westwood 24852d4305 XMLRPC: Improve the test case from [28854] so that it truely tests an invalid date string like the test name implies. See #28601.
git-svn-id: https://develop.svn.wordpress.org/trunk@29061 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-10 13:55:46 +00:00
Andrew Nacin adbe839132 WP_Comment_Query: Add fields => 'ids' query var.
props mordauk.
fixes #28434.


git-svn-id: https://develop.svn.wordpress.org/trunk@29045 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-09 18:15:42 +00:00
John Blackbourn b3e3684d21 Add support for a full path parameter to `is_page()` and `is_single()`. Props Jesper800, engelen, johnbillion. Fixes #16802.
git-svn-id: https://develop.svn.wordpress.org/trunk@29039 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-09 16:03:17 +00:00
Scott Taylor 8ce7c39e44 Allow an `array()` to be passed as the value for `orderby` to `WP_Query`. Allows for an independent `order` value for each key.
Example: `'orderby' => array( 'title' => 'DESC', 'menu_order' => 'ASC' )`.

Adds docs and unit tests.

Props wonderboymusic, johnbillion, DrewAPicture, dd32, andy.
See #17065.


git-svn-id: https://develop.svn.wordpress.org/trunk@29027 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-08 17:15:53 +00:00
Scott Taylor 3708cdc7c2 Bring back `define( 'WP_INSTALLING', true );` in `phpunit/includes/install.php`, which was removed in [28965]. tl;dr = wp-cli. Unit tests still pass in multisite because of the skips I added.
Fixes #28738, #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28988 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-04 01:38:43 +00:00
Sergey Biryukov ff3644a220 Fix texturization of quotes when enclosed by angle brackets.
props miqrogroove.
fixes #28718.

git-svn-id: https://develop.svn.wordpress.org/trunk@28971 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 16:21:18 +00:00
Scott Taylor 16aa589a07 URLs need to be generated, not hard-coded, in `user/listAuthors.php` test.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28968 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 02:13:08 +00:00
wonderboymusic 26aa4e4e7f Make sure permalink structure is consistent when running query tests.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28967 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 01:50:02 +00:00
Scott Taylor f23a5ef832 Setup rewrite changes in tests in a predictable fashion. Don't mix method calls with wrapper function calls.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28966 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 01:42:57 +00:00
Scott Taylor 73bde8a278 Transient timeouts are untestable when `WP_INSTALLING` is defined and set to ANY value. Transient timeouts cannot be tested during multisite runs because `wpmu_create_blog()` sets `WP_INSTALLING`. I have zero idea how these tests ever passed.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28965 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 01:16:33 +00:00
Scott Taylor 80a817ebcc Make sure hundreds of canonical tests don't fail in multisite every other time they are run.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28964 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-03 00:49:32 +00:00
Scott Taylor 4379ec80d6 This test in `post/revisions.php` is too misleading and doesn't work as expected since multiple queries can occur before the one that is intended for testing.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28962 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-02 19:56:50 +00:00
Scott Taylor d38227dbae `test_wp_get_shortlink()` assumes permalink structure is '' when it starts. It is not.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28961 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-02 19:49:05 +00:00
Scott Taylor 59b255c445 URLs in unit tests need to be generated, not hard-coded.
See #28706.


git-svn-id: https://develop.svn.wordpress.org/trunk@28960 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-02 19:44:08 +00:00
Sergey Biryukov 00a3c15185 Reorder test functions in term.php for consistency. Add @ticket references.
see #26570.

git-svn-id: https://develop.svn.wordpress.org/trunk@28953 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-02 01:49:41 +00:00
Sergey Biryukov 2ce93f915d Clarify the docs and add more unit tests for wp_set_object_terms().
props DrewAPicture.
fixes #26570.

git-svn-id: https://develop.svn.wordpress.org/trunk@28951 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-02 01:27:07 +00:00
Scott Taylor 9ab7f4b144 Avoid polluted `$table_prefix` and `$_wp_switched_stack` in multisite unit tests.
Add `WP_TESTS_TABLE_PREFIX` in `bootstrap.php` to ensure the original value for `$table_prefix` is always available. 

Props jeremyfelt.
Fixes #28692.


git-svn-id: https://develop.svn.wordpress.org/trunk@28943 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-01 18:51:46 +00:00
Sergey Biryukov 99d75b6acb Make wp_kses_no_null() remove any invalid control characters in a string.
props mauteri, miqrogroove.
fixes #28506.

git-svn-id: https://develop.svn.wordpress.org/trunk@28942 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-01 18:00:50 +00:00
Sergey Biryukov 92a7523362 Asterisk is an allowed character in a URI and should not be stripped out by wp_sanitize_redirect().
fixes #28362.

git-svn-id: https://develop.svn.wordpress.org/trunk@28939 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-01 15:55:04 +00:00
Sergey Biryukov 8b0ef058f3 WP_Date_Query: The inclusive logic should include all times within the date range.
props mboynes, oso96_2000, DrewAPicture.
fixes #26653.

git-svn-id: https://develop.svn.wordpress.org/trunk@28935 602fd350-edb4-49c9-b593-d223f7449a82
2014-07-01 01:17:39 +00:00
Sergey Biryukov a756c57fd9 Add @expectedIncorrectUsage to Tests_Taxonomy::test_register_long_taxonomy().
see #28683.

git-svn-id: https://develop.svn.wordpress.org/trunk@28926 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-30 15:09:52 +00:00
Andrew Nacin 9e24832a0e Add initial unit tests for multisite's bootstrap.
props jeremyfelt.
fixes #27884.


git-svn-id: https://develop.svn.wordpress.org/trunk@28910 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-29 22:50:44 +00:00
Andrew Nacin 02094174f9 Add index key support for wp_list_pluck(), à la array_column().
props trepmal.
fixes #28666.


git-svn-id: https://develop.svn.wordpress.org/trunk@28900 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-29 21:25:21 +00:00
John Blackbourn 3c77cf1140 Introduce `is_https_url()` for testing whether the scheme for a given URL is `https`. See #28487.
git-svn-id: https://develop.svn.wordpress.org/trunk@28894 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-29 11:31:25 +00:00
Scott Taylor 56e66c79b4 `wp_extract_urls()` should not match dates.
Updates unit tests.

Props hinnerk, sergej.mueller.
Fixes #28222.


git-svn-id: https://develop.svn.wordpress.org/trunk@28882 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-28 04:15:30 +00:00
Scott Taylor dca6040b0b In multisite, on the `updated_option` action, if the option name is one of: 'blogname', 'siteurl', 'post_count' - refresh the blog details cache for the current blog id.
Adds unit test.

Props kovshenin.
Fixes #26410.


git-svn-id: https://develop.svn.wordpress.org/trunk@28881 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-28 04:06:12 +00:00
Scott Taylor c2b7f8022c Add `->get_quality()` method to `WP_Image_Editor` class.
Adds unit tests.

Props markoheijnen.
Fixes #28154.


git-svn-id: https://develop.svn.wordpress.org/trunk@28879 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-28 03:49:55 +00:00
SergeyBiryukov bc83ca24d4 Use correct data providers.
props miqrogroove.
see #28564.

git-svn-id: https://develop.svn.wordpress.org/trunk@28860 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 19:07:03 +00:00
Sergey Biryukov f09a6ee73c Use correct data provider.
see #27426.

git-svn-id: https://develop.svn.wordpress.org/trunk@28859 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 18:59:55 +00:00
Sergey Biryukov 146bcaa937 XML-RPC: Make sure wp.newPost does not produce a fatal error when a post_date field is included in the data.
props dllh.
fixes #28601.

git-svn-id: https://develop.svn.wordpress.org/trunk@28854 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 17:42:17 +00:00
Scott Taylor 0f45c941f6 Fix `wpautop()` unit tests. See #25646, #22230, #25856.
Props rachelbaker.
Fixes #28638.


git-svn-id: https://develop.svn.wordpress.org/trunk@28853 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 17:27:49 +00:00
Scott Taylor 8103dc5ade Use less greedy regex in `wptexturize()`. Adds unit tests.
Props miqrogroove.
See #28564.


git-svn-id: https://develop.svn.wordpress.org/trunk@28852 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 17:14:47 +00:00
Scott Taylor b917e7998d `get_blog_details()->post_count` should update on more actions than just `publish_post`.
Adds unit test.

Props 5um17, midxcat, strangerstudios.
Fixes #27952.


git-svn-id: https://develop.svn.wordpress.org/trunk@28835 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-26 00:52:25 +00:00
Scott Taylor 96484fd3f9 Optimize the `wptexturize()` loop:
* Take the ampersand pattern out of the loop for speed.
* Fix old bugs in the ampersand pattern.
* Refactor `_wptexturize_pushpop_element()` without PCRE for speed.
* Update unit tests.

Props miqrogroove.
Fixes #28623.


git-svn-id: https://develop.svn.wordpress.org/trunk@28831 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-25 17:48:20 +00:00
Scott Taylor 73fe9d548b Ensure that a `has_children` parameter is given to `Walker::start_el()`.
Adds unit tests.

Props scribu, obenland.
Fixes #14041.


git-svn-id: https://develop.svn.wordpress.org/trunk@28824 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-24 17:05:56 +00:00
Sergey Biryukov ddaf46505d Add @ticket references.
see #27268.

git-svn-id: https://develop.svn.wordpress.org/trunk@28819 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-24 03:54:52 +00:00
Scott Taylor 882f41cb64 Add unit tests for [28817].
git-svn-id: https://develop.svn.wordpress.org/trunk@28818 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-24 00:54:22 +00:00
Scott Taylor 220fda0095 In `$wpdb->update()`, prevent explosions when `$where` is empty.
Adds unit tests.

Props UmeshSingla, wonderboymusic.
Fixes #26106


git-svn-id: https://develop.svn.wordpress.org/trunk@28814 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-24 00:23:09 +00:00
Sergey Biryukov ee307dc160 Use assertCount() for consistency with other tests.
see #28611.

git-svn-id: https://develop.svn.wordpress.org/trunk@28809 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-23 22:26:12 +00:00
Sergey Biryukov f7d7ecd0a6 Prevent multiple hierarchical posts with the same slug from being displayed in single post template.
fixes #28611.

git-svn-id: https://develop.svn.wordpress.org/trunk@28803 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-23 13:14:39 +00:00
Sergey Biryukov f393fecbc5 Add @ticket references.
see #16854, #19198.

git-svn-id: https://develop.svn.wordpress.org/trunk@28800 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-22 01:40:38 +00:00
Scott Taylor 5c48c4f8a8 Allow `wp_die()` to die in plain text when running the test suite.
Props jorbin.
Fixes #27749.


git-svn-id: https://develop.svn.wordpress.org/trunk@28797 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-21 19:59:28 +00:00
Scott Taylor a7c1728f2e Reinstate the changes from [28579] with some adjustments:
* Check `! empty( $postarr['file'] )` before calling `update_attached_file()`
* Add a unit test: `test_update_attachment_fields()`
* Run the same logic for empty `guid` for attachments that always ran in `wp_insert_post()`, as per #18310. This fixes a unit test that would have broken when this ticket was marked closed.
* Updated the unit test in `Tests_Media::test_wp_prepare_attachment_for_js()` to account for `url` no longer being empty

Props kovshenin, wonderboymusic.
See #21963.


git-svn-id: https://develop.svn.wordpress.org/trunk@28788 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-20 18:26:17 +00:00
Scott Taylor 33275a0826 Cleanup after [28671]:
* Set better defaults in `paginate_links()`, so that themes don't have to calculate them on their own, like Twenty Fourteen does now.
* Don't set page 1 to `?page=1` or `/page/1/` - that will force a canonical redirect.
* Add and cleanup unit tests

Props obenland, SergeyBiryukov, wonderboymusic.
Fixes #24606.


git-svn-id: https://develop.svn.wordpress.org/trunk@28785 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-20 17:11:14 +00:00
Scott Taylor 5ec545d5ab Revert [28613] and [28664]. A good idea, but too much BC baggage.
See #28099.



git-svn-id: https://develop.svn.wordpress.org/trunk@28783 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-20 16:20:35 +00:00
Scott Taylor 0688f9eb49 In `wptexturize()` + tests:
* Allow well-formed HTML inside of shortcode attributes
* Restrict recursion. HTML is allowed but ignored.
* Do not allow exotic HTML comments in shortcode attributes.
* Continue to ignore the [ and ] chars if they appear in any HTML attribute.
* Update related regex patterns.
* Update unit tests.

Props miqrogroove.
Fixes #28564.


git-svn-id: https://develop.svn.wordpress.org/trunk@28773 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-18 19:48:46 +00:00
Andrew Ozz b8fd9d997e TinyMCE: update to 4.0.28+. Includes all changes until 09-06-2014: 32cb108d41. Changelog: 32cb108d41/changelog.txt.
See #28391.

git-svn-id: https://develop.svn.wordpress.org/trunk@28768 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 23:49:00 +00:00
Scott Taylor b11edb94d9 Fix abbreviations mixed with quotes, example: `'99% of people'`.
Add/alter unit tests.

Props miqrogroove.
Fixes #26850.


git-svn-id: https://develop.svn.wordpress.org/trunk@28765 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 20:18:38 +00:00
Scott Taylor 1f4d925102 In `wptexturize()`, adjust for the treatment of abbreviated years at the end of quotations.
Silence some unit tests that have never passed and may no longer be applicable.

Props miqrogroove.
Fixes #18549.


git-svn-id: https://develop.svn.wordpress.org/trunk@28764 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 20:13:54 +00:00
Scott Taylor 6f658551d6 Add unit tests to confirm that `---` is properly converted to `&#8212;` by `wptexturize()` where appropriate.
Props miqrogroove.
Fixes #28483.


git-svn-id: https://develop.svn.wordpress.org/trunk@28763 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 18:06:12 +00:00
Scott Taylor 14f3b15d69 Add Unit Tests for i18n and `wptexturize()`. Don't confuse closing single quotes and apostrophes.
See #27426.


git-svn-id: https://develop.svn.wordpress.org/trunk@28762 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 17:56:08 +00:00
Scott Taylor 03a6e5f1fb `wptexturize()` adjustments:
* Only place an apostrophe before a number when it has exactly two digits.
* Never match '99' with the single prime pattern.
* Always assume '99' is an abbreviated year at the end of a quotation.
* Add unit tests.
* Resolves the unit test broken in [28721] for #8775.

See #26850.


git-svn-id: https://develop.svn.wordpress.org/trunk@28761 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-17 17:40:07 +00:00
Dominik Schilling (ocean90) 106e1dbedb Use the value of `WP_TESTS_DOMAIN` in some unit tests.
props danielhuesken.
fixes #28552.

git-svn-id: https://develop.svn.wordpress.org/trunk@28757 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-16 15:07:37 +00:00
Scott Taylor eadc17c4f9 In `wp_insert_term()`, when no slug is provided, check for an existing term by name. If it exists, use that slug instead of calling `sanitize_title( $name )`.
Prevents creating an endless number of terms like `A+` or `$$$$` in any given taxonomy.

Props wonderboymusic, SergeyBiryukov, aaroncampbell.
Fixes #17689.


git-svn-id: https://develop.svn.wordpress.org/trunk@28733 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-11 02:27:36 +00:00
Scott Taylor 821c052473 In `wptexturize()`, ensure that texturization does not corrupt contents of HTML elements, HTML comments, and smartcode attributes.
Adds a variety of unit tests/assertions.

Props miqrogroove.
Fixes #12690, #8912, #27602.


git-svn-id: https://develop.svn.wordpress.org/trunk@28727 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 14:33:16 +00:00
Scott Taylor 9e347a40c2 In `wptexturize()`, allow dashes before and after curly quotes. Example: This is what she said---"Wow that is cool."
Adds unit tests.

Props adamsilverstein, miqrogroove.
Fixes #20342.


git-svn-id: https://develop.svn.wordpress.org/trunk@28726 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 14:21:36 +00:00
Scott Taylor 66b539bdab `wptexturize()` should handle apostrophes before primes.
Props nacin, miqrogroove.
Fixes #22823.


git-svn-id: https://develop.svn.wordpress.org/trunk@28725 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 14:13:52 +00:00
Scott Taylor 013f3f14e3 Fix curly quotes around numbers when applicable.
Adds unit tests.

Props filosofo, mrmist, aliso, MikeHansenMe, miqrogroove.
Fixes #8775.


git-svn-id: https://develop.svn.wordpress.org/trunk@28721 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 02:42:35 +00:00
Scott Taylor a66f776684 In `wptexturize()`, don't convert C-style hexadecimals to mathematical `×`.
Adds unit tests.

Props harrym, kurtpayne, miqrogroove.
Fixes #19308.


git-svn-id: https://develop.svn.wordpress.org/trunk@28719 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 02:17:24 +00:00
Scott Taylor f9bcf40db7 In `wptexturize()`, treat `&nbsp;` like whitespace when texturizing hyphens.
Adds unit tests.

Props redsweater, miqrogroove.
Fixes #23185.


git-svn-id: https://develop.svn.wordpress.org/trunk@28718 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 02:08:05 +00:00
Scott Taylor db7816dd0c `smilies_init()`, treat `&nbsp;` like whitespace when converting smilies.
Adds unit tests.

Props miqrogroove.
Fixes #27587.


git-svn-id: https://develop.svn.wordpress.org/trunk@28717 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 02:02:23 +00:00
Scott Taylor 97bacb3121 Ensure that `shortcode_unautop()` treats `&nbsp;` like whitespace.
`shortcode_unautop()` and `wptexturize()` now use `wp_spaces_regexp()` instead of raw regex.

Adds unit tests.

Props miqrogroove.
See #27588.


git-svn-id: https://develop.svn.wordpress.org/trunk@28716 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 01:54:11 +00:00
Scott Taylor cfe11de507 Fix a unit test for the now deprecated function `like_escape()`.
Props miqrogroove.
Fixes #10041.


git-svn-id: https://develop.svn.wordpress.org/trunk@28714 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 01:21:33 +00:00
Scott Taylor 4459acb59d Remove unnecessary `->test()` method from `Tests_Canonical_HTTPS` to avoid PHP error.
See [28704].


git-svn-id: https://develop.svn.wordpress.org/trunk@28713 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 01:09:43 +00:00
Scott Taylor 2a551f57a4 `LIKE` escape sanity:
* Deprecate `like_escape()`
* Add a method to `$wpdb`, `->esc_like()`, and add unit tests

`$wpdb::esc_like()` is not used yet. As such, many unit tests will throw `Unexpected deprecated notice for like_escape`. Subsequent commits will alleviate this.

Props miqrogroove.
See #10041.


git-svn-id: https://develop.svn.wordpress.org/trunk@28711 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-10 00:29:35 +00:00
Scott Taylor 12e325582a Update unit tests to reflect:
* [28673] - title attributes are no longer expected to be present in some assertions
* [28704] - Fix `Declaration of Tests_Canonical_HTTPS::test() should be compatible with Tests_Canonical::test($test_url, $expected, $ticket = 0)`
* [28679] - Add `@expectedDeprecated get_all_category_ids`


git-svn-id: https://develop.svn.wordpress.org/trunk@28706 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-09 15:58:16 +00:00
John Blackbourn 65890b4858 Add some basic unit tests for HTTPS canonical redirects. See #27954.
git-svn-id: https://develop.svn.wordpress.org/trunk@28704 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-09 01:05:46 +00:00
Sergey Biryukov 4fde71e75d Avoid an empty href attribute in paginate_links(). Add unit tests.
props obenland, Nessworthy.
fixes #24606.

git-svn-id: https://develop.svn.wordpress.org/trunk@28671 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-05 02:09:12 +00:00
Scott Taylor ee9f2e48bb After [28613], also kill queries that explicityly pass empty arrays to `category__in`, `tag__in`, `tag_slug__in`, and `author__in` to `WP_Query`.
Adds unit tests.
Fixes #28099.


git-svn-id: https://develop.svn.wordpress.org/trunk@28664 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-04 17:49:26 +00:00
Scott Taylor 1ffe74ad6f Fix SQL generation when `meta_query` has an `'relation' => 'OR'` for its queries and wants to `'orderby' => 'meta_value'`.
Adds unit test.

Props jackreichert.
Fixes #25538.



git-svn-id: https://develop.svn.wordpress.org/trunk@28659 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-04 05:47:19 +00:00
Sergey Biryukov 4ecfd017b8 Capitalize 'ID' correctly to avoid random failures of Tests_Tax_Query::test_term_taxonomy_id_field_no_taxonomy().
see #25284.

git-svn-id: https://develop.svn.wordpress.org/trunk@28647 602fd350-edb4-49c9-b593-d223f7449a82
2014-06-01 03:17:16 +00:00
Scott Taylor 273fd5ca4c Add more test coverage for `wpdb`.
See #26999.


git-svn-id: https://develop.svn.wordpress.org/trunk@28635 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-30 19:17:15 +00:00
Scott Taylor 1a1994b20f Adds a unit test to demonstrate that the order of `case` and `default` in a `switch` statement does not matter.
See #27882.



git-svn-id: https://develop.svn.wordpress.org/trunk@28631 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-30 17:31:51 +00:00
Scott Taylor 7f49c1320a `@uses` means something entirely different for unit tests. More: http://thephp.cc/viewpoints/blog/2014/03/phpunit-4-0-code-coverage-improvements
Code coverage analysis takes forever to run, and these annotations will cause it to fail in the middle.

See #26999.



git-svn-id: https://develop.svn.wordpress.org/trunk@28625 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 23:33:13 +00:00
Scott Taylor 8bb2117aad If `post_status` is passed to `WP_Query` as an array containing `'any'` and anything else, don't exclude the other values if they match when running `any`'s exclusion logic.
Adds unit tests.

Fixes #28007.


git-svn-id: https://develop.svn.wordpress.org/trunk@28622 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 20:41:53 +00:00
Scott Taylor eba9bf7171 These unit tests should point at an actual attachment file.
See [28619].


git-svn-id: https://develop.svn.wordpress.org/trunk@28621 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 20:39:05 +00:00
Scott Taylor fcff169970 Add unit tests to confirm that `post__in` orderby is working as expected with `menu_order` based on comments from #28012.
git-svn-id: https://develop.svn.wordpress.org/trunk@28619 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 18:23:58 +00:00
Scott Taylor 8530693a51 If `post__in` or `post_parent__in` is passed to `WP_Query` as an empty array, nuke the query. Both vars are currently only checked for truthiness after which they are ignored. Setting these vars at all indicates explicit filtering being desired.
Adds unit test.

Fixes #28099.


git-svn-id: https://develop.svn.wordpress.org/trunk@28613 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 06:03:15 +00:00
Andrew Nacin 961459ee31 Forcing SSL logins now forces SSL for the entire admin, with no middle ground.
fixes #10267.


git-svn-id: https://develop.svn.wordpress.org/trunk@28609 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-29 03:58:41 +00:00
Sergey Biryukov 1140c47c30 Exclude 'test-image.bmp' from the list of non-displayable image types.
props atimmer.
fixes #28386.

git-svn-id: https://develop.svn.wordpress.org/trunk@28603 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-28 22:20:36 +00:00
Scott Taylor 4dd4a32cde In `wp_get_object_terms()`, before returning terms (and before running them through the 'wp_get_object_terms' filter) - run them through `$terms = array_values( array_unique( $terms, SORT_REGULAR ) )`.
There will be "dupes" when the function is called with `'fields' => 'all_with_object_id'`, but the objects will actually be unique due to the `object_id` addition, so they shouldn't be filtered out. 

Adds unit tests. All other unit tests pass.

Fixes #11003.


git-svn-id: https://develop.svn.wordpress.org/trunk@28583 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-27 03:28:05 +00:00
Scott Taylor b2db40a694 Add unit tests for functions in `wp-includes/category.php`.
Props mdbitz. 
Fixes #28119.


git-svn-id: https://develop.svn.wordpress.org/trunk@28566 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-23 21:07:18 +00:00
Scott Taylor e2a124a911 When adding queries to `tax_query`: if the query's `field` is `term_taxonomy_id`, don't require `taxonomy` to be specified. In `WP_Tax_Query::transform_query()`, `$query['taxonomy']` is never checked for the 'term_taxonomy_id' `case` because 'term_taxonomy_id' is the primary key being looked up.
Adds unit tests.

Props helen.
Fixes #25284.



git-svn-id: https://develop.svn.wordpress.org/trunk@28562 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-23 19:58:52 +00:00
Scott Taylor 1061a15eaf Allow `get_comments_number()` to officially accept `$post` or `$post_id`. Adds unit tests.
Props coffee2code, JanHenkG.
Fixes #26240.


git-svn-id: https://develop.svn.wordpress.org/trunk@28558 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-23 17:43:03 +00:00
Sergey Biryukov 5edb7a633f Remove unnecessary array_reverse() from wp_get_post_revisions().
WP_Query properly handles multiple 'orderby' values since [28541].

fixes #26042.

git-svn-id: https://develop.svn.wordpress.org/trunk@28543 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-22 18:50:11 +00:00
Scott Taylor 0baa73f2e4 Apply `order` to each passed value for `orderby` in `WP_Query`:
* Since `orderby` in `WP_Query` can accept space-delimited sets, yet only one `order` value: when multiple values are passed (and `DESC` is the order), the default sort order `ASC` is being applied to all values before the last in the set.
* There is a unit test that sporadically fails since 3.6 in `tests/post/revision` due to multiple posts having the same `post_date` from being added so rapidly
* When ordering revisions in `wp_get_post_revisions()`, order by `post_date ID`
* Change the `order` value in `wp_get_post_revisions()` to `ASC`. This will produce SQL like: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID ASC`. Previously, this would have produced SQL like: `ORDER BY $wpdb->posts.post_date DESC`, and with the addition of ` ID`: `ORDER BY $wpdb->posts.post_date ASC, $wpdb->posts.ID DESC`. Clearly, wrong. The original SQL produced: `ORDER BY $wpdb->posts.post_date DESC`. As such, return the reversions in reverse order using `array_reverse()`. Not doing so would break "Preview Changes."
* Add unit tests to assert that all of this works.
* All existing unit tests pass with the change to ordering multiple `orderby`s in `WP_Query`.
* In the future, we should support independent `order` for each `orderby`, see #17065.

Props SergeyBiryukov, wonderboymusic.
Fixes #26042.


git-svn-id: https://develop.svn.wordpress.org/trunk@28541 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-22 18:18:11 +00:00
Scott Taylor bf54ad6054 Add missing access modifiers to methods in `WP_Query`. Add magic methods for `__get()`, `__set()`, `__isset()`, `__unset()`, and `__call()`.
Add unit test for magic methods.

See #27881, #22234.


git-svn-id: https://develop.svn.wordpress.org/trunk@28523 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 06:48:56 +00:00
Scott Taylor d6a3c2a0de Add access modifiers to methods and members of list table classes:
* `WP_List_Table` is the base class that implements `__get()` and `__call()` for BC
* Adds unit tests to confirm that subclasses properly inherit magic methods
* Add modifiers to subclasses: `WP_Links_List_Table`, `WP_Media_List_Table`, `WP_MS_Sites_List_Table`, `WP_MS_Themes_List_Table`, `WP_MS_Users_List_Table`, `WP_Plugin_Install_List_Table`, `WP_Plugins_List_Table`, `WP_Posts_List_Table`, `WP_Terms_List_Table`, `WP_Theme_Install_List_Table`, `WP_Themes_List_Table`

See #27881, #22234.


git-svn-id: https://develop.svn.wordpress.org/trunk@28493 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-19 01:16:16 +00:00
Scott Taylor 85ac5c214d Add a unit test that demonstrates a magic getter.
See #27881.



git-svn-id: https://develop.svn.wordpress.org/trunk@28480 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-18 21:14:13 +00:00
Scott Taylor 17edee17af Eliminate the use of `extract()` in `the_taxonomies()`. Adds unit test.
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28421 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 05:24:54 +00:00
Scott Taylor 3e54a1fab5 Eliminate use of `extract()` in `get_the_taxonomies()`. Adds unit test.
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28415 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 03:50:46 +00:00
Scott Taylor c47d71feb2 Add unit tests for `wp_list_pages()`.
Props MikeHansenMe.
See #27326.



git-svn-id: https://develop.svn.wordpress.org/trunk@28400 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 01:17:37 +00:00
Scott Taylor e4a800238f Eliminate use of `extract()` in `wp_dropdown_pages()`.
Adds unit tests to: `tests/post/template.php`. 
There was previously only one wimpy assertion for `wp_dropdown_pages()`.
	
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28399 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 01:11:21 +00:00
Scott Taylor 21e0370e5c Eliminate use of `extract()` in `wp_link_pages()`.
Adds unit tests to a new file: `tests/post/template.php`. 
There were previously no unit tests for `wp_link_pages()`.
	
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28398 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-15 00:43:40 +00:00
Scott Taylor 9e07b1037e Eliminate use of `extract()` in `paginate_links()`. Adds unit tests. Moves `tests/general/template.php` (which only had one method) to `tests/general/paginateLinks.php`.
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28397 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-14 22:28:08 +00:00
Scott Taylor 77731c03fc Eliminate use of `extract()` in `wp_get_archives()`.
Adds unit tests: `tests/functions/getArchives.php`. 
All other unit tests pass.

Props MikeHansenMe, wonderboymusic.
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28379 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-13 04:28:56 +00:00
Scott Taylor 4e0809e3e4 Eliminate use of `extract()` in `wp_insert_category()`. Adds unit tests. All unit tests pass.
Props MikeHansenMe.
See #22400.


git-svn-id: https://develop.svn.wordpress.org/trunk@28374 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-13 03:26:51 +00:00
Scott Taylor b70967302b In `get_the_author_posts()`, if there is no current `$post`, return `0` and bail.
Props krogsgard, aaroncampbell.
Fixes #27998.



git-svn-id: https://develop.svn.wordpress.org/trunk@28362 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-11 00:25:29 +00:00
Andrew Nacin cb022f4957 Multisite: Treat 'www' as a special subdomain, reversing 3.9 regression.
props jeremyfelt.
fixes #27927.


git-svn-id: https://develop.svn.wordpress.org/trunk@28280 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-06 05:31:12 +00:00
Scott Taylor 89ecbcc7cb In `WP_Date_Query::get_sql_for_subquery()`, don't parse duplicate parameters - only parse one of `w` and `week` or `month` and `monthnum`.
Adds unit tests.

Props oso96_2000, ChriCo.
Fixes #25835.



git-svn-id: https://develop.svn.wordpress.org/trunk@28252 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-04 23:06:07 +00:00
Andrew Nacin 790cb99b27 Shortcode JS: Avoid errors when an escaped shortcode includes a newline between brackets.
props gcorne.
props Clorith, jorbin for tests.
see #27907, for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@28223 602fd350-edb4-49c9-b593-d223f7449a82
2014-05-01 03:36:27 +00:00
Dominik Schilling (ocean90) a13b695fbd Customizer: Allow to skip cropping header images if image width is smaller than or equal to theme width.
Add tests.

see #27936 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@28219 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-25 20:24:28 +00:00
Dominik Schilling (ocean90) fd26def119 Revert [28217].
Misfired commit for #27936.

git-svn-id: https://develop.svn.wordpress.org/trunk@28218 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-25 20:17:59 +00:00
Dominik Schilling (ocean90) 5d8f69e0c5 Recent Posts Widget: Use `ob_end_flush()` instead of `ob_flush()`.
`ob_end_flush()` flushes the output buffer *and* turns output buffering off, same as `ob_get_flush()`.

props m_i_n.
see #28009 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@28217 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-25 14:20:05 +00:00
Scott Taylor 67a0a4fd14 Add a conditional unit test for Tax Query - one query that does an `IN` query for categories with `relation` for `tax_query` set to `AND`. Weird queries are being produced.
See #27193. 



git-svn-id: https://develop.svn.wordpress.org/trunk@28188 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-23 17:40:25 +00:00
Andrew Ozz 77a65852fa Update the TinyMCE tests to 4.0.21.1, see #27744
git-svn-id: https://develop.svn.wordpress.org/trunk@28138 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-15 22:06:11 +00:00
Andrew Nacin 32721b8347 Avoid stomping of bulk postdata inside the bulk_edit_posts() loop.
Reverts [27990] which did not fix it for authors and comment/ping status.

props dd32, DrewAPicture.
fixes #27792.


git-svn-id: https://develop.svn.wordpress.org/trunk@28113 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-14 07:47:10 +00:00
Andrew Nacin aa08fb55ce User Query: Don't blindly re-append new meta queries for capabilities.
fixes #21119.


git-svn-id: https://develop.svn.wordpress.org/trunk@28087 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-12 19:03:56 +00:00
Andrew Nacin 5a7934a362 Fix a multisite test failure by testing an option that can be updated in multisite.
fixes #22936.


git-svn-id: https://develop.svn.wordpress.org/trunk@28067 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-10 21:09:33 +00:00
Andrew Nacin eef7258ca6 Update license copyright year to 2014.
fixes #27728.


git-svn-id: https://develop.svn.wordpress.org/trunk@28064 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-09 23:49:05 +00:00
Sergey Biryukov df3eaf73cb Fix copy/paste error in [27710].
props kovshenin.
fixes #21969.

git-svn-id: https://develop.svn.wordpress.org/trunk@27915 602fd350-edb4-49c9-b593-d223f7449a82
2014-04-02 23:46:34 +00:00
Andrew Nacin e3171a42a3 Add PHP and JS unit tests for custom headers.
props mcsf, ehg.
see #21785.


git-svn-id: https://develop.svn.wordpress.org/trunk@27847 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-29 10:05:22 +00:00
Andrew Nacin d8a3ebc173 JavaScript Unit Tests: Add Sinon (sinonjs.org) for test mocks, stubs, etc. see #21785.
git-svn-id: https://develop.svn.wordpress.org/trunk@27846 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-29 09:58:55 +00:00
Andrew Nacin f0bd2b8a91 Texturize: Massive performance improvements (~600% faster); better handling of nbsp, double, and weird spaces; 136 new unit tests.
big props miqrogroove.
fixes #22692.


git-svn-id: https://develop.svn.wordpress.org/trunk@27839 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-29 07:15:33 +00:00
Andrew Nacin 05ea231402 Avoid infinite recursion in get_term_children() when a term is incorrectly a parent of itself.
props kovshenin.
fixes #27123.


git-svn-id: https://develop.svn.wordpress.org/trunk@27837 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-29 06:07:17 +00:00
Andrew Nacin 0ad35e169b Revert the conversion of adjacent post queries to WP_Query. Explanation on the ticket.
Reverts [27285], [27286], [27287], [27288], [27291], [27292], [27293], [27296], [27633], [27634], [27635], and [27692].

see #26937.


git-svn-id: https://develop.svn.wordpress.org/trunk@27836 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-29 06:02:01 +00:00
Andrew Nacin 7a3c12d985 Add a unit test for shortlinks of a page on front.
see #26871, see [27802].


git-svn-id: https://develop.svn.wordpress.org/trunk@27803 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-28 03:01:43 +00:00
Scott Taylor 17e4da2bd8 Remove `html5` theme support on `tearDown()` so theme settings don't leak into other tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@27795 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-27 20:54:08 +00:00
Scott Taylor 7b7e5305c7 In `multi_resize()` image editor methods, assert that `null` can only be passed for one of the arguments, not both. Add a lot more unit test assertions to ensure this.
Props pbearne, DH-Shredder.
Fixes #26823.



git-svn-id: https://develop.svn.wordpress.org/trunk@27794 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-27 20:39:08 +00:00
Scott Taylor 115f291221 Use `wp_parse_id_list()` when parsing `exclude_tree` in `get_pages()`. Add unit tests to ensure a URL string, array with string as value, and array with array as value for `exclude_tree` can be used to specify multiple IDs.
Props cgaffga, roothorick, hakre, tbrams for patches across the years.
Fixes #9153.



git-svn-id: https://develop.svn.wordpress.org/trunk@27767 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-27 01:17:41 +00:00
Andrew Nacin 28663b08e8 Remove select and input from wpautop()'s HTML blocks list.
props rachelbaker, DH-Shredder.
fixes #22230.


git-svn-id: https://develop.svn.wordpress.org/trunk@27761 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-27 00:00:17 +00:00
Scott Taylor 09c4928cf7 In `wp_list_pages()`, add the `current_page_item` class where applicable when used with a custom post type.
Adds a unit test.

Props nacin.
Fixes #17590.



git-svn-id: https://develop.svn.wordpress.org/trunk@27755 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-26 22:46:16 +00:00
Andrew Nacin 36496a3877 Revert [27166].
We should not be accounting for improper assignment of WP_Query properties.

fixes #26321.


git-svn-id: https://develop.svn.wordpress.org/trunk@27746 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-26 18:42:41 +00:00
Andrew Nacin 79ff680b93 WP_Theme: Return false from the display() method when get() fails.
Fixes a potential warning on the themes page when the active theme is deleted.

fixes #26873.


git-svn-id: https://develop.svn.wordpress.org/trunk@27745 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-26 18:21:45 +00:00
Helen Hou-Sandi ccc5f363c0 Use Dashicon-style images for mime type icons. Actually moving to Dashicons via the font can be explored later, but has theme/plugin implications and requires too many changes to make it for 3.9. props melchoyce for the icons. fixes #26650.
git-svn-id: https://develop.svn.wordpress.org/trunk@27726 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 21:09:34 +00:00
Scott Taylor 815adc833a Popular tags' edit links should respect the current post type. Adds unit test.
Props mordauk, fahmiadib.
Fixes #25566.



git-svn-id: https://develop.svn.wordpress.org/trunk@27720 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 18:39:26 +00:00
Andrew Nacin fbb2e1dc89 Transients: Allow a non-expiring transient to be updated with an expiry.
props shahpranaf, sandyr.
fixes #22807.


git-svn-id: https://develop.svn.wordpress.org/trunk@27719 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 18:22:49 +00:00
Andrew Nacin 07eb830a9b Ensure the $path is trailing-slashed in domain_exists().
Adds tests for [27717].

props ejdanderson, ericmann.
fixes #20589.


git-svn-id: https://develop.svn.wordpress.org/trunk@27718 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 17:39:08 +00:00
Andrew Nacin c9531d6d67 Encode spaces in get_template_directory_uri() and get_stylesheet_directory_uri().
props SergeyBiryukov.
fixes #21969.


git-svn-id: https://develop.svn.wordpress.org/trunk@27710 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 13:06:21 +00:00
Andrew Nacin 3e28e2fae8 Multisite: Don't set the $super_admins global in grant_super_admin(), revoke_super_admin().
Adds tests and docs.

props jdgrimes.
see #27205.


git-svn-id: https://develop.svn.wordpress.org/trunk@27706 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-25 12:13:40 +00:00
Andrew Nacin 05f0bcabec Use the current post's post type when determining post adjacency.
props ethitter.
fixes #26937.


git-svn-id: https://develop.svn.wordpress.org/trunk@27692 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 21:29:14 +00:00
Scott Taylor 82ba1702df When using `meta_query` in a `WP_Query`, passing `NOT EXISTS` or `''` to `compare` should not require `value` to be set. The resulting SQL should then produce the appropriate `OR` clause for existence of non-existence after passing the query to the `$key_only_queries` stack internally.
Adds unit tests. 

Props chrisguitarguy, for the original patch.
Fixes #23268.



git-svn-id: https://develop.svn.wordpress.org/trunk@27689 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 19:56:54 +00:00
Scott Taylor 710f11f2df When using WP_Query's `"fields" => "ids"` (or `"fields" => "id=>parent"`), the returned values should be an array of integers, not array of integers represented by strings.
Adds unit tests. All other unit tests pass.

Props danielbachhuber.
Fixes #27252.



git-svn-id: https://develop.svn.wordpress.org/trunk@27686 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 18:54:38 +00:00
Scott Taylor 651b4a5f5b Fix the video shortcode unit test after [27519].
git-svn-id: https://develop.svn.wordpress.org/trunk@27685 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 17:13:48 +00:00
Scott Taylor 88b610dc72 Fix a swath of broken unit tests from `Tests_User_ListAuthors`.
git-svn-id: https://develop.svn.wordpress.org/trunk@27684 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 16:52:38 +00:00
Andrew Ozz 2dc003fb02 Two files weren't deleted in [27679], see #27014
git-svn-id: https://develop.svn.wordpress.org/trunk@27680 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 06:12:08 +00:00
Andrew Ozz 0898014ebd Update the TinyMCE tests.
In 4.0.20 all tests were reworked. The 'testrunner' was removed and the PhantomJS Runner QUnit plugin was added making it possible to run the tests from cli. However it is still necessary to run the tests in all supported browsers to test the fixes for all browser quirks and normalization. Also all tests are loaded in one html file.

See #27014

git-svn-id: https://develop.svn.wordpress.org/trunk@27679 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-24 05:59:45 +00:00
Andrew Nacin 0963ea19a0 Fix various issues with WP_Adjacent_Post:
* Performance / number of queries.
 * Incorrect results caused by sticky posts.
 * Back compat for filters, which had used "WHERE" while WP_Query does not; and fixing table references.

props ethitter.
fixes #26937.


git-svn-id: https://develop.svn.wordpress.org/trunk@27635 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-20 02:58:48 +00:00
Andrew Nacin 681ca37c63 Return false from metadata_exists() if the get_$type_metadata filter returns a false value.
props xknown.
fixes #22746.


git-svn-id: https://develop.svn.wordpress.org/trunk@27562 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-17 19:39:31 +00:00
Andrew Nacin 05911cc3d4 Explicitly assign menu term relationship rather than piggybacking on wp_insert_post() with the tax_input argument.
That argument currently depends on user context (see #19373).

Adds unit test for properly updating orphaned menu items.

props danielbachhuber.
fixes #27113.


git-svn-id: https://develop.svn.wordpress.org/trunk@27556 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-15 06:06:41 +00:00
Andrew Nacin f4cc32fac9 XML-RPC: In wp.editPost, Remove all terms in a taxonomy when an empty array is explicitly passed.
props jstraitiff, maxcutler.
fixes #26686.


git-svn-id: https://develop.svn.wordpress.org/trunk@27554 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-15 05:08:40 +00:00
Andrew Nacin 0ed014743d Allow query strings for servers in IXR_Client and WP_HTTP_IXR_Client.
props cfinke.
fixes #26947.


git-svn-id: https://develop.svn.wordpress.org/trunk@27552 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-15 05:00:27 +00:00
Andrew Nacin 8355232a65 Avoid saving slashed data in XML-RPC's wp.setOptions.
props danielbachhuber.
fixes #22936.


git-svn-id: https://develop.svn.wordpress.org/trunk@27551 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-15 04:46:53 +00:00
Andrew Nacin 5adf89fe26 Pass feed_type arg in wp_list_authors() to get_author_feed_link().
Adds a slate of tests for wp_list_authors().

props MikeHansenMe.
fixes #26538.


git-svn-id: https://develop.svn.wordpress.org/trunk@27550 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-15 04:42:57 +00:00
John Blackbourn 22eb8b34ef Improve `paginate_links()` performance by not calling `number_format_i18n()` unnecessarily. Fixes #25735 with tests. Props johnpbloch.
git-svn-id: https://develop.svn.wordpress.org/trunk@27523 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-13 17:38:51 +00:00
Scott Taylor 36df368171 In `WP_Query::get_queried_object()`, account for `pre_get_posts` by checking for `tag` when `tag_id` isn't present. Tags still need to be rolled up into `tax_query`. Add a unit test confirming expected query vars during and after `pre_get_posts`.
Props mattonomics for a patch.
See #27362.



git-svn-id: https://develop.svn.wordpress.org/trunk@27511 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-12 04:07:41 +00:00
Andrew Nacin 020ba8e15a Revert [27492]. see #27112.
git-svn-id: https://develop.svn.wordpress.org/trunk@27493 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-10 23:29:49 +00:00
Andrew Nacin f36e40de2c Add widget customizer tests missing from [27419]. see #27112.
git-svn-id: https://develop.svn.wordpress.org/trunk@27492 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-10 23:04:53 +00:00
Andrew Nacin 036cb74d46 Add unit tests for searching by relevance.
props wonderboymusic.
see #7394, #20044.


git-svn-id: https://develop.svn.wordpress.org/trunk@27474 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-08 21:26:26 +00:00
Andrew Nacin f225973b62 Allow $crop in add_image_size() to receive crop anchors (top, left, right, bottom, center).
This also applies to set_post_thumbnail_size() and image_resize_dimensions().

props bradt, wonderboymusic, DH-Shredder.
fixes #19393.


git-svn-id: https://develop.svn.wordpress.org/trunk@27472 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-08 06:13:27 +00:00
Scott Taylor 613b28cc81 Remove a cache-busting hack from `Tests_Term_getTerms::test_get_terms_exclude_tree()`. It is no longer necessary after #14485 and #25711.
See [27300].
Props SergeyBiryukov.
Fixes #27313.



git-svn-id: https://develop.svn.wordpress.org/trunk@27459 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 19:35:55 +00:00
Scott Taylor 3010c5aa20 In `get_terms()`, leverage `get_term_children()` over `_get_term_children()` when making sure to show empty terms that have children in a hierarchical taxonomy while avoiding duplicates.
Adds unit test for `child_of` param. Adjusts unit tests for `get_terms()`.

See [27108] and [27125].
Props SergeyBiryukov.
Fixes #27123.



git-svn-id: https://develop.svn.wordpress.org/trunk@27458 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 19:29:01 +00:00
Scott Taylor dfc11a170b On second thought, allow `posts_per_rss` to be set in `pre_get_posts` to override the `posts_per_rss` option. There are backwards compatibility concerns otherwise.
Props nacin.
Partially reverts [27455]. Updates the unit test. See #25380.



git-svn-id: https://develop.svn.wordpress.org/trunk@27456 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 18:58:33 +00:00
Scott Taylor 65932f71fd When setting `posts_per_page` in `WP_Query::get_posts()`, check for `is_feed()` in the same place where `posts_per_page` is set when it is not already set. Previously, when `is_feed()` was true, `posts_per_page` would be arbitrarily overwritten. This fix allows `posts_per_page` to be set during `pre_get_posts` when `is_feed()` is true and not be overwritten.
Adds unit test.

Props wokamoto.
Fixes #25380.



git-svn-id: https://develop.svn.wordpress.org/trunk@27455 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-07 18:32:40 +00:00
Andrew Nacin a14b999605 Always convert auto-drafts to drafts in edit_draft() and _wp_translate_postdata().
This regressed due to refactoring in [26995]. This commit fixes Quick Draft.

see #25272.


git-svn-id: https://develop.svn.wordpress.org/trunk@27405 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-05 06:25:31 +00:00
Andrew Nacin ed43f002b8 Add has_password and post_password query variables to WP_Query.
* has_password true means posts with passwords, false means posts without.
 * post_password can query for posts with a particular password.

props wonderboymusic, robmiller.
fixes #20308.


git-svn-id: https://develop.svn.wordpress.org/trunk@27395 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 07:44:28 +00:00
Andrew Nacin 5edec1d792 Don't default to current user for capability checks when dealing with a post without an author (post_author = 0).
Undoes [12053]. While it risks breakage, this is a far safer and saner default for these situations.

props danielbachhuber.
fixes #27020.


git-svn-id: https://develop.svn.wordpress.org/trunk@27390 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 03:08:54 +00:00
Andrew Ozz e5bed6707f TinyMCE: update to 4.0.18, see #24067
git-svn-id: https://develop.svn.wordpress.org/trunk@27387 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-04 01:56:57 +00:00
Andrew Nacin eef62a9d0d Update PHPMailer to 5.2.7 from 5.2.4.
Includes two trivial modifications for WordPress:
 * Doesn't use the autoloader, so the check to enforce the autoloader from the constructor is removed.
 * Requires class-smtp.php for backwards compatibility with direct (non-wp_mail()) uses of PHPMailer, as the autoloader isn't used.

props bpetty.
fixes #25560.


git-svn-id: https://develop.svn.wordpress.org/trunk@27385 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 20:24:31 +00:00
Andrew Nacin 260b7f08ca Let get_the_date() accept a post object.
props tanner-m, adamsilverstein, bigdawggi.
fixes #13771.


git-svn-id: https://develop.svn.wordpress.org/trunk@27380 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 17:59:11 +00:00
Mark Jaquith 7937358328 Eliminate some of our last remaining `create_function()` instances
* Moved some into private function callbacks
* Eliminated some that weren't necessary anymore

props obenland, markjaquith, nacin. fixes #14424

git-svn-id: https://develop.svn.wordpress.org/trunk@27373 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 16:20:12 +00:00
Sergey Biryukov 7f3c71eff3 Add missing word. props bassgang. fixes #27259.
git-svn-id: https://develop.svn.wordpress.org/trunk@27371 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-03 09:46:36 +00:00
Andrew Nacin 6869d203d0 Introduce get_site_by_path() and further rewrite the site detection process for multisite.
This is the first big step to supporting arbitrary domains and paths. In this new approach, sites are detected first where possible, then the network is inferred. Allows filtering for arbitrary path segments, smooths out some weirdness, and removes various restrictions. A sunrise plugin could do much of its work by adding filters, if those are even needed.

see #27003.


git-svn-id: https://develop.svn.wordpress.org/trunk@27359 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 22:24:50 +00:00
Sergey Biryukov 3038bdc80f Restore $content_width global value after changing it in test_constrain_size_for_editor_*().
props ericlewis, georgestephanis, salcode, jorbin.
fixes #27256.

git-svn-id: https://develop.svn.wordpress.org/trunk@27358 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 22:22:41 +00:00
Sergey Biryukov f213decc7e Skip import tests if WordPress Importer plugin is missing.
props mattheu.
fixes #27250.

git-svn-id: https://develop.svn.wordpress.org/trunk@27349 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-02 10:34:58 +00:00
Andrew Nacin 8a617607a7 Strip backslashes, not just forward slashes, from untrailingslashit().
trailingslashit() will now remove any forward or backslashes from the end of a string before appending a forward slash.

props knutsp, willmot.
fixes #22267.


git-svn-id: https://develop.svn.wordpress.org/trunk@27344 602fd350-edb4-49c9-b593-d223f7449a82
2014-03-01 21:44:43 +00:00
Andrew Nacin 88f1b6e7ec Add a $default argument to get_query_var() and WP_Query::get(). fixes #16471.
git-svn-id: https://develop.svn.wordpress.org/trunk@27304 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 23:57:10 +00:00
Andrew Nacin 68c8b9cf0f Introduce doing_filter() and doing_action() to identify hooks in progress.
did_action() returns true the moment a hook is initially run, leaving you no way to tell if the hook is still in progress. Hooks can be nested and this checks the entire stack, versus current_filter() which only identifies the final hook in the stack. This commit also introduces current_action() for parity.

To tell if a hook has completed, one can use did_action() and ! doing_action() together.

The functions do not require an argument. In that situation, they indicate whether the stack is empty.

props ericmann for the initial unit tests.
fixes #14994.


git-svn-id: https://develop.svn.wordpress.org/trunk@27294 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 18:43:59 +00:00
Mark Jaquith 1d91296b3b Return 404 when querying author's posts who is not a member and has no posts on the site
fixes #20601. props yoavf, nacin, SergeyBiryukov, wonderboymusic, markjaquith.

git-svn-id: https://develop.svn.wordpress.org/trunk@27290 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 18:11:36 +00:00
Andrew Nacin 1d8d862e97 Make get_adjacent_post() wrap a new WP_Get_Adjacent_Post object that uses WP_Query.
git-svn-id: https://develop.svn.wordpress.org/trunk@27285 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-26 17:09:54 +00:00
Andrew Nacin a407ae2363 Allow user_id to be an array of IDs in WP_Comment_Query.
props mordauk.
fixes #27064.


git-svn-id: https://develop.svn.wordpress.org/trunk@27258 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 16:34:25 +00:00
Andrew Nacin f8af178264 Use ext/mysqli in PHP 5.5 or greater. Expect minor explosions.
props aaroncampbell, pento.
see #21663.


git-svn-id: https://develop.svn.wordpress.org/trunk@27250 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-25 00:39:28 +00:00
Andrew Nacin b74f222d33 Remove theme support for 'menus' in unregister_nav_menu() when there are no more menus.
props kovshenin.
fixes #26900.


git-svn-id: https://develop.svn.wordpress.org/trunk@27220 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-21 18:13:52 +00:00
Sergey Biryukov 1cda3b44cf Add @ticket references. see #26903.
git-svn-id: https://develop.svn.wordpress.org/trunk@27197 602fd350-edb4-49c9-b593-d223f7449a82
2014-02-20 02:20:40 +00:00