Commit Graph

397 Commits

Author SHA1 Message Date
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
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
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
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