Commit Graph

150 Commits

Author SHA1 Message Date
Scott Taylor
5de39fc2f1 Remove the Featured Content term filters when running Unit Tests. Set the return value of wp_get_object_terms() to a var before passing to array_shift() in test_get_object_terms_types(), which expects a var to be passed by reference.
See #25282.



git-svn-id: https://develop.svn.wordpress.org/trunk@26187 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-15 02:32:16 +00:00
Andrew Nacin
4bb79a2ce3 Add a unit test to confirm that the version number in readme.html matches version.php.
3.7.1 shipped with 3.7 in the readme. Not a big deal, but this should prevent it in the future.


git-svn-id: https://develop.svn.wordpress.org/trunk@26166 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-14 16:50:21 +00:00
Scott Taylor
6603f4802a Always clean install in PHPUnit Tests.
Props bpetty.
Fixes #25871.



git-svn-id: https://develop.svn.wordpress.org/trunk@26095 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 22:14:24 +00:00
Scott Taylor
2ccc101050 Make HTML tag searches for <code> and <pre> case-insensitive in make_clickable().
Props bpetty.
Fixes #23756.



git-svn-id: https://develop.svn.wordpress.org/trunk@26094 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 21:53:08 +00:00
Scott Taylor
8120f2861c The test for #5953 doesn't require the ticket to be closed for its assertions to pass.
See #25913.



git-svn-id: https://develop.svn.wordpress.org/trunk@26093 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 21:23:39 +00:00
Scott Taylor
a8e76ea8f9 Set the page_comments option to true in Tests_Canonical to properly check canonical redirection for paged comments. By doing so, one assertion tied to #20388 no longer needs to be.
See #20388, 25913.




git-svn-id: https://develop.svn.wordpress.org/trunk@26091 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 18:57:11 +00:00
Scott Taylor
3cbb68c3af Avoid Out of range value for column 'post_parent' error in Tests_Ajax_MediaEdit::_make_attachment() by setting the default parent id to 0 instead of -1
git-svn-id: https://develop.svn.wordpress.org/trunk@26088 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 17:51:29 +00:00
Scott Taylor
0fdff310fd Fix a failing unit test: an XML-RPC unit test for getPosts with filters was failing. The cause of the failure: a set of posts was created with create_many() and then paginated results were requested. The paginated results were meant to equal the original resultset when diff'd after all pages were joined. create_many() was assigning the same timestamp to all posts, so the LIMIT clause in the generated SQL was not operating as expected. I replaced the create_many() call with a create() loop that increments time by 1 each time. Unit test now passes.
git-svn-id: https://develop.svn.wordpress.org/trunk@26087 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-11 17:45:36 +00:00
Scott Taylor
e86c049a50 Fix inexcusable whitespace in tests/phpunit/tests/post/query.php.
Props wonderboymusic.



git-svn-id: https://develop.svn.wordpress.org/trunk@26056 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-08 23:13:41 +00:00
Scott Taylor
047f7fb8bd Produce proper CAST for DECIMAL and NUMERIC in Meta Query. Adds a bunch of unit tests.
Props ericlewis.
Fixes #23033.



git-svn-id: https://develop.svn.wordpress.org/trunk@26055 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-08 23:10:41 +00:00
Scott Taylor
cc19bb3a57 Respect the compare operator value in meta_query when value evaluates to null. Adds Unit Test.
Props bradyvercher, gradyetc.
Fixes #22967.



git-svn-id: https://develop.svn.wordpress.org/trunk@26053 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-08 22:51:03 +00:00
Scott Taylor
0670cf7cc4 Don't convert URLs inside <pre> and <code> tags when parsing string using make_clickable().
Adds Unit Tests.

Props johnjamesjacoby, helen, nacin, adamsilverstein, sirbrillig. 
Fixes #23756.



git-svn-id: https://develop.svn.wordpress.org/trunk@26052 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-08 22:37:41 +00:00
Andrew Nacin
aacc286f7c Use only one var per scope in our password-strength-meter tests.
props kadamwhite.
see #25187.


git-svn-id: https://develop.svn.wordpress.org/trunk@26040 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-07 20:40:12 +00:00
Sergey Biryukov
fc8d09e2a6 A negative term parent value should be sanitized to 0, not 1. Fix a regression in sanitize_term_field() caused by [26010].
props mattheu for initial patch.
fixes #25852.

git-svn-id: https://develop.svn.wordpress.org/trunk@26028 602fd350-edb4-49c9-b593-d223f7449a82
2013-11-06 23:40:46 +00:00
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
5c63859ffb Add jshintrc to qunit.
props jorbin.
see #25187.


git-svn-id: https://develop.svn.wordpress.org/trunk@25992 602fd350-edb4-49c9-b593-d223f7449a82
2013-10-30 14:38:37 +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
89febfe766 Expand the zxcvbn password meter blacklist, based on user input.
props iandunn.
see #25174.


git-svn-id: https://develop.svn.wordpress.org/trunk@25637 602fd350-edb4-49c9-b593-d223f7449a82
2013-09-28 06:46:29 +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 diffs.
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