Scott Taylor
d8f57f88ad
Respect `paged` when `offset` is used in `WP_Query`. Adds unit tests.
...
Props coffee2code.
Fixes #18897 .
git-svn-id: https://develop.svn.wordpress.org/trunk@26012 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-05 01:34:44 +00:00
Scott Taylor
ed22220a0f
Cast proper fields to `int` when returning from `wp_get_object_terms()`. Add `term_taxonomy_id` and `object_id` to the list in `sanitize_term()` and `sanitize_term_field()`.
...
Fixes #17646 . Adds unit tests.
Props simonwheatley, dd32, kovshenin.
git-svn-id: https://develop.svn.wordpress.org/trunk@26010 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-05 01:18:02 +00:00
Scott Taylor
0923b7b93a
Category and tag are typically checked before checking for a custom taxonomy. If the global query matches category or tag (even if it also has tax_query set), return category/tag as the queried object, instead of arbitrarily returning the first term in the `tax_query` stack (typically those added with 'pre_get_posts').
...
Real world example: http://www.emusic.com/17dots/topics/daily-download/ - "tag" page, regionalized for US-only content using `pre_get_posts` passing in the terms "US" and "ALL" for "region" (custom tax). All of the theme functions would output "ALL" as the term name. Even though it was a tag archive, the queried object was an arbitrary term from `tax_query`.
See [26006]. All unit tests pass.
Fixes #20767 .
git-svn-id: https://develop.svn.wordpress.org/trunk@26007 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-04 23:53:55 +00:00
Scott Taylor
5321bc4957
`WP_UnitTestCase::go_to()` tried its best to clean up global space, but ultimately fell short. Because it was blowing away `WP` every time it was called, it was dropping all the query vars that were registered for custom taxonomies and custom post types (ouch).
...
Introduces `_cleanup_query_vars()`. This is a prerequisite for the unit tests on #20767 . All unit tests pass with this change.
See #20767 .
Fixes #25818 .
git-svn-id: https://develop.svn.wordpress.org/trunk@26006 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-04 22:46:44 +00:00
Scott Taylor
2f38d2efc6
Move `Tests_Query_Conditionals::assertQueryTrue()` to `WP_UnitTestCase`. It should be available to all unit test classes. The conditionals class is huge, other classes are necessary for better coverage.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@26005 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-04 21:55:12 +00:00
Scott Taylor
ecbcfc5a20
Set the default parent id to 0, instead of -1, in `Tests_Post_Attachments::_make_attachment()`. Prevents `Out of range value for column 'post_parent'` database error without papering over it in core.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@26004 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-04 21:39:35 +00:00
Andrew Nacin
9b9311ae2b
Move the unit test added in [25974] to the more appropriate file. see #25750 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25975 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-29 01:47:48 +00:00
Andrew Nacin
2cac0fde8a
Avoid resetting the 'hierarchical' argument in get_pages() when 'parent' is -1, the default.
...
Fixes a regression introduced in [25270]. Adds unit tests.
props chrisbliss18.
fixes #25750 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25974 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-29 01:46:01 +00:00
Sergey Biryukov
ddf0147a4f
Move test_get_pages_include_exclude() and test_get_pages_parent() to tests/post/getPages.php. Add a @ticket reference. see [25168] and [25244].
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25972 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-28 21:49:27 +00:00
Andrew Nacin
add8bc4e57
Add a $taxonomy argument to each of the adjacent post functions.
...
Each took an array of category (IDs) when to search. Those can now be term IDs and each function now has $taxonomy = 'category' as an optional argument.
Functions affected: get_previous_post(), get_next_post(), get_adjacent_post(), get_adjacent_post_rel_link(), adjacent_posts_rel_link(), next_post_rel_link(), prev_post_rel_link(), get_boundary_post(), get_previous_post_link(), previous_post_link(), get_next_post_link(), next_post_link(), get_adjacent_post_link(), adjacent_post_link().
props ethitter.
finally fixes #17807 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25959 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-27 21:39:51 +00:00
Andrew Nacin
90b55d0279
Fix the exclude_tree argument in get_terms(), which fixes the exclude argument in wp_list_categories().
...
This was a 3.7 regression caused by [25162].
props dd32.
see #25710 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@25933 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-26 15:03:10 +00:00
Andrew Nacin
559dc21202
3.7 regression from [25119]: Have in_category() return false when the first argument is empty.
...
Adds unit tests.
props ericlewis.
fixes #25706 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@25923 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-26 02:53:30 +00:00
Andrew Nacin
5e119ca3b4
Revert [25202] and enforce that wp_add_inline_style() does not want <style> tags.
...
Prior to 3.7, these tags were not printed (and thus needed to be provided), but only in the admin and when concatenation was enabled. They should never be required. Strip them when we find them and issue a notice for incorrect usage.
props atimmer, georgestephanis.
fixes #24813 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25786 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-15 14:34:33 +00:00
Andrew Nacin
5ceab9b1e3
Test runner: Add @expectedIncorrectUsage to trap _doing_it_wrong() calls.
...
see #24813 , #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25785 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-15 14:30:02 +00:00
Andrew Nacin
c02412fa8d
Remove tests for code still in development, see #22229 . If accidentally run, they produce fatal errors.
...
props pauldewouters, no_fear_inc.
git-svn-id: https://develop.svn.wordpress.org/trunk@25711 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-07 14:17:13 +00:00
Andrew Nacin
fc1438c8bc
Move the trim() from wp_set_password() to inside wp_hash_password().
...
props rpattillo, joehoyle.
fixes #24973 . see #23494 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25709 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-07 13:53:09 +00:00
Scott Taylor
f3488744ce
Add a default value to `WP_UnitTest_Factory_For_Comment::default_generation_definitions['comment_content']` to avoid a tornado of database errors in PHP 5.5/MySQL 5.6, even when `WP_DEBUG` is turned off.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25660 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-02 19:46:58 +00:00
Scott Taylor
7918d5cd98
Make `url_to_postid()` work for custom post type URLs. Use `get_post_types()` and `get_taxonomies()` instead of directly accessing globals. Adds unit test.
...
Props faishal, for the globals fix.
Fixes #19744 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25659 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-02 19:41:19 +00:00
Andrew Nacin
57a5269b13
Live network counts of users and sites for small networks.
...
props adamsilverstein, jeremyfelt.
fixes #22917 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25621 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-25 16:20:21 +00:00
Andrew Nacin
13408ddcbd
Introduce a reset_postdata() method on the WP_Query object, which wp_reset_postdata() now wraps.
...
props ericlewis.
fixes #24785 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25601 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-24 15:52:41 +00:00
Andrew Nacin
b0717588b7
Introduce register_taxonomy_for_object_type().
...
props leewillis77.
fixes #11058 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25596 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-24 02:54:00 +00:00
Andrew Nacin
05c7da77fa
Revert [25446] now that `wp_blogs`.`archived` is no longer an ENUM field. see #14511 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25590 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-24 01:19:27 +00:00
Andrew Nacin
fbc417775d
In wp_count_posts(), rename 'count_posts' hook to 'wp_count_posts', for clarity. see #16603 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25578 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-23 19:07:08 +00:00
Scott Taylor
74ec1ce5ed
`tests/phpunit/data/images/a2-small-100x75.jpg` should not be checked in - it is generated in a test method and `unlink()`'d since [25507].
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25557 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-21 18:51:55 +00:00
Scott Taylor
5a74d939ec
Add hooks to `wp_count_posts()`. Adds filter docs. Adds unit test to test `count_posts` filter.
...
Props nacin, DrewAPicture.
Fixes #16603 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25554 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-21 17:54:36 +00:00
Scott Taylor
325b1bf175
Ensure that terms with a post count of `0` are not returned in `wp_count_terms()` when `hide_empty => true`. Adds unit test which ensures that `wp_count_terms()` returns `0`.
...
Props markjaquith.
Fixes #15919 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25551 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-21 16:47:43 +00:00
Scott Taylor
b20688456e
`unlink()` the generated image in `Tests_Image_Intermediate_Size::test_make_intermediate_size_successful()` at the end of the test to avoid cruff in `svn diff`s.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25507 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-19 18:05:11 +00:00
Sergey Biryukov
a30670afc6
Introduce 'offset' parameter for wp_get_sites().
...
props jamescollins.
see #14511 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25488 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-19 01:46:03 +00:00
Andrew Nacin
d06cb2443f
Proper treatment of the 'archived' field in wp_get_sites(). see #14511 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25446 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-14 23:09:59 +00:00
Andrew Nacin
eb2e3536a9
Introduce wp_get_sites(), a long-awaited replacement for get_blog_list().
...
props jeremyfelt.
see #14511 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25445 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-14 21:12:26 +00:00
Andrew Nacin
564d5a51c2
Reinstate an assertion commented out in [25409]. This test is skipped due to @ticket anyway. see #25282 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25440 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-14 19:17:31 +00:00
Scott Taylor
535ae26afd
Fix several esoteric errors related to AJAX unit tests for comments:
...
* `wp_ajax_get_comments()` relies on the `$post_id` global - even though `$_POST['p']` is passed to every action in the test methods. If `$post_id` is still lingering in between tests and doesn't match `p` in the request, the cap check might pass while the queries for comments will blow up. I added `unset( $GLOBALS['post_id'] )` to `Tests_Ajax_GetComments::setUp()`.
* If the global `$post_id` is empty, but `$_REQUEST['p']` is not, `$post_id` is now set to `absint( $_REQUEST['p'] )` and sanity-checked in `wp_ajax_get_comments()`.
* `map_meta_cap()` always assumes that `get_comment()` succeeds when checking for the `edit_comment` cap. It doesn't. I added sanity checks in a few places where it will break early if `get_post()` or `get_comment()` are empty.
* `wp_update_comment()` always assumes `get_comment()` succeeds. It doesn't. I added a check for empty.
All AJAX unit tests run and pass in debug mode. All general unit tests pass against these changes.
Fixes #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25438 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-14 18:35:43 +00:00
Scott Taylor
402e61f269
Fix some undefined index notices related to Comment unit tests:
...
* There are several places where a `$_POST` index was unchecked before setting a variable
* In `wp_notify_postauthor()`, `$comment` was being returned null, but its properties were being accessed.
* In `check_ajax_referer()`, 3 different values can be checked for nonce on `$_REQUEST`, but only 1 had an `isset()`
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25433 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-13 22:17:51 +00:00
Scott Taylor
d85e040859
Remove the unnecessary call to `ob_end_clean()` directly after `ob_get_clean()` in `WP_Ajax_UnitTestCase::dieHandler()`. This fixes a large number of AJAX errors in debug mode.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25432 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-13 21:32:54 +00:00
Scott Taylor
f76f2a692a
Fix an error in `tests/ajax/Compression` by removing the unnecessary call to `ob_end_clean()` immediately after `ob_get_clean()` in `_gzdecode`, which has aleady deleted the buffer.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25431 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-13 21:29:12 +00:00
Andrew Nacin
9d9a28b3e0
Test framework: Update path to multisite.xml.
...
props jeremyfelt.
fixes #25242 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25415 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 21:04:16 +00:00
Andrew Nacin
4c8f1e263a
Use @expectedDeprecated. see #25282 , [25408].
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25409 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 18:37:32 +00:00
Andrew Nacin
d5d476974e
Test framework: Introduce the annotation @expectedDeprecated, modeled after PHPUnit's @expectedException.
...
It works for both functions and arguments (using the value of the first argument passed to _deprecated_function() or _deprecated_argument(), which is typically the function name). It asserts both ways:
* If specified, those deprecated notices must be caught, or the test fails.
* If not specified, any other deprecated notices cause the test to fail.
Works regardless of WP_DEBUG.
see #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25408 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 18:37:00 +00:00
Andrew Nacin
9bfe9b7230
Revert [25405] and use a file that does exist. see #25282 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25407 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 17:47:40 +00:00
Scott Taylor
8a2c79d897
Fix the failing l10n assertions:
...
* Check if the file exists before running `true` assertions
* If the file doesn't exist, run `false` assertions
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25405 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 17:36:45 +00:00
Scott Taylor
404fd85586
Fix the failing `Tests_Link::test_wp_get_shortlink()` assertion:
...
* `wp_get_shortlink()` was firing a notice when reading `$post->ID` while `$post` was null in some cases
* Before the assertions that assume `$GLOBALS['post']` is not set, call `unset( $GLOBALS['post'] );` - there was global spillage from other tests
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25404 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 17:30:01 +00:00
Scott Taylor
654d07ebf9
There was way too much duplicated code in my notice cleanup, it built up over time, and there's definitely a need to standardize.
...
* Remove duplicated code for deprecated function notice suppression
* Add support in `WP_UnitTestCase` setUp/tearDown methods for `$deprecated_functions` fixture if the extending class has added it
* Add a `$deprecated_functions` fixture to each extending class that needs it
To use this fixture, add something to your Test Case class like so:
`protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' );`
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25402 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 14:47:58 +00:00
Scott Taylor
3ae18e68ff
* Fill in undefined var in `Tests_Option_BlogOption`
...
* Add `defined()` check for `BLOGSUPLOADDIR`
* Suppress deprecated function notices for `is_blog_user()` and `get_dashboard_blog()`
* Check existence of `$user` in `wpmu_log_new_registrations()` before arbitrarily making a database query
Fixes all notices in multisite unit tests.
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25397 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 07:16:30 +00:00
Scott Taylor
285db00ed4
Suppress `Non-static method PO::*() should not be called statically, assuming $this from incompatible context` by using the `@` silencer in `tests/pomo/po.php`
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25395 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 06:46:35 +00:00
Scott Taylor
13381bfcdc
* `sort()` returns a boolean, not a sorted set. Move the calls out of the assertions and fix the test methods.
...
* Fix instances where `Only variables should be passed by reference` was being triggered by assigning `array_keys()` return value to a var
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25394 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 06:41:36 +00:00
Scott Taylor
d58aace6f7
Avoid `undefined variable` notice - `wp_insert_user()` expects `user_pass` to be passed to it.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25393 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 06:28:25 +00:00
Scott Taylor
d1d5bcf036
* Add `isset()` checks all over `WP_User_Query::prepare_query()` and `WP_User_Query::query()`. When a `WP_User_Query` instance is constructed without passing args, no query vars are filled in, thus `$qv` doesn't contain most of the expected indices.
...
* Suppress an undefined index notice in `tests/user/query.php`
Fixes #25292 .
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25392 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 06:24:09 +00:00
Scott Taylor
c0c3359572
* Suppress deprecated function notice for `set_current_user()`
...
* Add assertions for `wp_set_current_user()`
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25391 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 06:06:07 +00:00
Scott Taylor
b18d047edd
* Avoid `Only variables should be passed by reference` notice by passing a var to `array_pop()` in `tests/user.php`
...
* Suppress a notice by silencing the passing of a non-existent object prop
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25390 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 05:56:59 +00:00
Scott Taylor
6acb4cf24d
Don't assume `$GLOBALS['post']` is set in `tests/url.php`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25389 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 05:52:53 +00:00
Scott Taylor
f4ac65db2d
* Suppress deprecated function notices in `tests/theme/themeDir.php`
...
* Set `$theme['Template Files']` and `$theme['Stylesheet Files']` to a variable before calling array methods upon them - avoids `Indirect modification of overloaded element has no effect` notice
* Clean up setUp/tearDown in `tests/theme.php`
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25388 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 05:48:58 +00:00
Scott Taylor
ee35baae6b
Suppress the `_doing_it_wrong` notices when calling `add_theme_support( 'html5' )` in `tests/theme/support.php`
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25387 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 05:39:45 +00:00
Scott Taylor
f9877147f6
Use `reset()` to access the first element of an array, don't assume there is an item at index `0`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25384 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 05:08:33 +00:00
Scott Taylor
6ced366e7c
Add a `post_id` fixture in `test/meta/slashes.php` so `Undefined variable: comment_post_ID` notices don't fire when creating comments.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25383 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:59:29 +00:00
Scott Taylor
9cb4234c3f
* Fix the horrendous whitespace in `tests/media.php`
...
* Suppress the deprecated function notice for `wp_convert_bytes_to_hr()`
* Add assertions for `size_format()`
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25382 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:55:24 +00:00
Scott Taylor
1e460fd6e2
Avoid a notice and clean up setting/unsetting of globals by moving them into `setUp()` and `tearDown()` methods in `Tests_Mail`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25381 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:46:49 +00:00
Scott Taylor
a76e6cef7d
* Avoid notice by making `WP_Image_Editor_Mock::test()` compatible with `WP_Image_Editor::test()`.
...
* Suppress deprecated function notice for `wp_load_image()`.
* Add assertion for `wp_get_image_editor()`.
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25380 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:40:13 +00:00
Scott Taylor
dc35c8d11e
Pass a variable that actually exists to `seems_utf8()` in `tests/formatting/SeemsUtf8.php`
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25379 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:28:34 +00:00
Scott Taylor
7001aeaa11
Suppress the deprecated function notice in `tests/formatting/CleanPre.php`
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25378 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:20:48 +00:00
Scott Taylor
691e3f25a0
Fix the PHP 5.4 `Only variables should be passed by reference` notices in `tests/filters.php`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25377 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:16:59 +00:00
Scott Taylor
62b7214706
Avoid an undefined index error in `tests/phpunit/tests/dependencies/styles.php`
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25376 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:13:11 +00:00
Scott Taylor
148d8e1e29
Suppress the `doing_it_wrong` notice from firing in `tests/phpunit/`tests/dependencies/jquery.php` when running in debug mode.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25375 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:08:03 +00:00
Scott Taylor
591a96743e
Passing non-existent object properties to `WP_UnitTestCase::assertNull()` produces notices, opt instead for `WP_UnitTestCase::assertTrue( empty( $obj->prop ) )` in `tests/db.php`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25374 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 04:01:34 +00:00
Scott Taylor
85881c19dc
Fix the PHP 5.4 `Only variables should be passed by reference` notices in `tests/action.php`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25373 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-12 03:53:56 +00:00
Scott Taylor
f97a98011b
Pass `$args` as an array, rather than a splat, to `wp_clear_scheduled_hook()`. There are comments in the code describing the deprecated argument behavior.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25368 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 22:21:43 +00:00
Scott Taylor
a3a7be77e3
Suppress deprecated notices for `wp_shrink_dimensions()`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25367 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 22:16:43 +00:00
Scott Taylor
6de2f44495
`get_home_url()` assumes `$GLOBALS['pagenow']` is set. It isn't in `Tests_URL`... and now it is.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25366 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 22:06:21 +00:00
Scott Taylor
38474ef5d1
Fix undefined index notices in `comment/slashes` test cases. `wp_new_comment()` and `edit_comment()` expect more variables than were being passed.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25365 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 21:56:31 +00:00
Scott Taylor
eddb6d958b
Add a `$post_id` fixture to `Tests_Comment_Query`. Comments created without passing `comment_post_ID` produce an undefined variable notice in `wp_insert_comment()`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25364 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 21:47:14 +00:00
Scott Taylor
169ddb12ad
Set `$_SERVER['REQUEST_METHOD'] = null` in `Tests_Auth::setUp()` to suppress undefined index notices when `wp_validate_auth_cookie()` is called.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25363 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 21:37:46 +00:00
Scott Taylor
e7c543f997
Restore the test code for `get_theme()`, add the notice suppression filters, and fix the type in the `remove_filter()` call.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25362 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 21:32:14 +00:00
Scott Taylor
9f00115bd9
Avoid the following notice: `Use of undefined constant term_id - assumed 'term_id'`, while running in debug mode.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25356 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 18:45:34 +00:00
Scott Taylor
961adfb51e
Update the unit test methods in `Tests_Admin_includesTheme`. Use `wp_get_theme()` instead of `get_theme()`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25355 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 18:39:09 +00:00
Scott Taylor
fc372eb7b8
Add action/filter to `Tests_Theme::setUp()` to suppress errors while running back-compat tests on `get_theme()`, `get_themes()`, `get_theme_data()`, `get_current_theme()`.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25354 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 18:30:06 +00:00
Scott Taylor
135198d66d
Use `get_users()` instead of the deprecated `get_users_of_blog()` in `Tests_User_Capabilities::setUp()` to avoid a tornado of warnings in debug mode.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25353 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 17:55:12 +00:00
Scott Taylor
9dc7afd478
Add `set_current_screen( 'front' )` to `query/conditionals` tests `setUp` routine so that cruff from previous tests doesn't cause every conditional test to fail in debug mode.
...
See #25282 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25352 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 17:40:46 +00:00
Scott Taylor
0c0c81d81c
Add `term_taxonomy_id` to available fields in `get_term_by()`. Adds unit test.
...
Props jchristopher.
Fixes #21651 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25334 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-11 00:01:19 +00:00
Scott Taylor
d738f5e586
Support `orderby => meta_value` in `WP_User_Query`. Adds unit test.
...
Props wpsmith.
Fixes #21581 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25331 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-10 23:09:10 +00:00
Scott Taylor
5a75531f19
Replace the ancient `phpfreaks.com` RegEx to extract urls to ping with a more robust matcher. URLs with commas and things like `&` were not being pinged. The new matcher even works for most IDN URLs. Adds unit tests.
...
Fixes #9064 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25313 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-10 03:17:51 +00:00
Scott Taylor
e72ffa5d96
Move checks for `post_type` being an array inline. See [25291], [25292], #18614 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25312 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-10 03:01:10 +00:00
Andrew Nacin
7f7aacbdec
wp_allowed_protocols() should not contain 'data', as it is not safe. see #19354 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25301 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-08 19:41:14 +00:00
Sergey Biryukov
c47302e70f
Use correct paths in multisite.xml. see [25165]. see #25088 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25294 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-07 15:19:56 +00:00
Scott Taylor
e688f070dc
Check the value passed to `get_post_type_object()`. If it's an array, use the first item. `get_query_var( 'post_type' )` can be an array if the query has been altered via filters/actions. There are several places in core that pass the query var. Adds unit tests.
...
In `template-loader.php`, move `is_post_type_archive()` and `is_tax()` directly below `is_home()`.
See #18614 , [25291].
git-svn-id: https://develop.svn.wordpress.org/trunk@25292 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-06 23:38:51 +00:00
Scott Taylor
48dc7e576b
Ensure that the post type object is the queried object when a post type has been registered with `has_archive => true`. Ensure it is not stomped when decorated with `tax_query`. Adds unit tests.
...
Props nacin.
Fixes #18614 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25291 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-06 22:06:40 +00:00
Scott Taylor
0474a18863
Allow `is_tag()` to accept `term_id`, `slug`, 'term_name` or array of any. Many other `is_*()` funcs already do this. Adds unit tests.
...
Props ramiy.
Fixes #18746 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25287 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-06 17:26:04 +00:00
Scott Taylor
09b9c44de9
Check bad dates and redirect, instead of 404ing, as necessary and appropriate.
...
Adds query, conditional, and canonical Unit Tests.
Props kovshenin, SergeyBiryukov, DrewAPicture.
Fixes #10935 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25280 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-06 16:35:22 +00:00
Scott Taylor
93cfccac2d
Add unit test for `tax_query` against attachments.
...
See #22556 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25278 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-06 14:43:49 +00:00
Andrew Nacin
27b0660c5f
Add a test case for calling get_page_uri() with a non-existent post.
...
see #24491 , [25262].
git-svn-id: https://develop.svn.wordpress.org/trunk@25265 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 22:02:42 +00:00
Andrew Nacin
f280a2f525
Remove old WP version checks from PHPUnit test cases now that tests are branched with each version.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25264 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 21:56:10 +00:00
Scott Taylor
a5d3bde7a0
Avoids incorrect results when `url_to_postid()` checking is not strict enough. Adds a bunch of Unit Tests for `url_to_postid()', which is currently only tested lightly in some XML-RPC tests.
...
Props gcorne, gradyetc.
Fixes #20560 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25258 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 17:28:52 +00:00
Scott Taylor
e8c7634e79
Avoid database error when `include` or `exclude` is not really a `term_id`. Adds more unit tests.
...
Props kovshenin.
Fixes #11823 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25257 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 17:14:54 +00:00
Scott Taylor
83d1992d34
When `meta_type` is passed with `orderby => meta_value`, `orderby` must also use `CAST()` to avoid scenarios like: `SELECT`ing by `UNSIGNED` and then ordering by `CHAR`. Adds unit test.
...
Fixes #21621 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25255 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 16:56:36 +00:00
Scott Taylor
16ef2c2e36
Remove lingering instances of call time pass-by-reference, limited to instances of `callable` - use `$this` instead of `&$this`.
...
Props jdgrimes.
See #25160 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25254 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-05 16:33:50 +00:00
Scott Taylor
57b1d5ab28
Introduce `author__in` and `author__not_in` query vars. Fixes issue with multiple author exclusion when comma-separated string is passed for `author`. Adds a bunch of missing unit tests.
...
Props pollett for initial patch.
Fixes #16854 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25248 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 21:32:11 +00:00
Scott Taylor
0b28c0137d
Allow `get_pages()` to accept an `array` for the arg `parent`. Adds unit tests, some will fail until the next commit.
...
Fixes #9470 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25244 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 20:55:05 +00:00
Scott Taylor
0877a3eda4
Remove `error_reporting()` debug cruff.
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25242 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 19:56:06 +00:00
Scott Taylor
89997e4c80
Introduce `description__like` arg to `get_terms()`. Make `description__like` and `name__like` perform `LIKE`s with a wildcard on both sides of passed string. Previously, strings had to match the beginning of the name, so searching for `burrito` in `This is a burrito` would fail. Adds unit tests.
...
Props aaroncampbell for the original patch, 5 years ago.
Fixes #8214 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25241 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 19:40:17 +00:00
Scott Taylor
d10b9d32a0
Remove unnecessary checks before setting `$wp_settings_*` arrays. Adds unit test for setting a nonexistent variable to a multi-dimensional `array`.
...
Props scribu.
Fixes #17884 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25240 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 19:06:13 +00:00
Scott Taylor
24bf60bb4f
Kill the query in the following edge case: `post_type => 'any'` but `exclude_from_search => false` returns no valid post types. Adds unit tests.
...
Props mitchoyoshitaka.
Fixes #19198 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25239 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 18:50:04 +00:00
Scott Taylor
0d0b17b617
Convert `category__and` to `category__in` (less expensive) and unset it when only one category is passed. Adds unit tests.
...
Fixes #24245 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25238 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 18:16:31 +00:00
Andrew Nacin
db5f9800d4
add_theme_support( 'html5' ) now defaults to comment-list, comment-form, and search-form.
...
This was the implicit case in 3.6.0, modified in [25193].
see #24932 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25235 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 17:43:29 +00:00
Scott Taylor
1e0d32406d
Allow `int` to be passed in lieu of `array`, add `append` arg to `wp_set_post_categories()`. Adds more extensive unit tests for `wp_set_post_categories()`.
...
Props ptahdunbar for initial patch.
Fixes #16550 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25234 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 17:41:03 +00:00
Dion Hulse
5d57f260ed
WP_HTTP: Replacing the Fsockopen & Streams Transports with a new Streams transport which fully supports HTTPS communication.
...
This changeset also bundles ca-bundle.crt from the Mozilla project to allow for us to verify SSL certificates on hosts which have an incomplete, outdated, or invalid local SSL configuration.
Props rmccue for major assistance getting this this far. See #25007 for discussion, also Fixes #16606
git-svn-id: https://develop.svn.wordpress.org/trunk@25224 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-04 04:48:21 +00:00
Sergey Biryukov
59989c2de0
Update tests/README.txt to reflect the new tests directory structure. props jdgrimes. fixes #25133 .
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25199 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-31 13:42:56 +00:00
Andrew Nacin
788973ffb2
Case insensitivity for is_email_address_unsafe().
...
props jkudish.
fixes #25046 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25197 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-31 04:35:15 +00:00
Andrew Nacin
afe7f94304
Fix 'html5' theme support.
...
* Require it to have a second argument when adding.
* Merge, rather than replace, on second add.
* Make current_theme_supports() work when two arguments are passed.
Adds unit tests.
props nathanrice for initial patch.
see #24932 for trunk.
git-svn-id: https://develop.svn.wordpress.org/trunk@25193 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-31 01:29:08 +00:00
Andrew Nacin
f6966d20b3
Basic tests for wp_parse_id_list() to ensure positive integers. see [25169].
...
git-svn-id: https://develop.svn.wordpress.org/trunk@25170 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-29 18:58:40 +00:00
Scott Taylor
f458d16c01
Improve the include / exclude SQL generation in `get_pages()` by using `IN` and `NOT IN` where applicable. Adds unit tests for include / exclude.
...
Fixes #22074 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25168 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-29 18:48:29 +00:00
Andrew Nacin
8045afd81b
Move PHPUnit tests into a tests/phpunit directory.
...
wp-tests-config.php can/should reside in the root of a develop checkout. `phpunit` should be run from the root.
see #25088 .
git-svn-id: https://develop.svn.wordpress.org/trunk@25165 602fd350-edb4-49c9-b593-d223f7449a82
2013-08-29 18:39:34 +00:00