Commit Graph

286 Commits

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