Commit Graph

694 Commits

Author SHA1 Message Date
Boone Gorges fffff63fbe Revert shared taxonomy term splitting for 4.1.
This is a revert of [30494], [30492], [30347], and [30334]. The latter
changeset was a revert of [30336], which was a revert of [30241].

Watch for Term Splitting, Version III in version 4.2, coming soon to a
WordPress trunk near you.

See #30335, #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30585 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-27 00:04:59 +00:00
ocean90 ebfa390ea1 Type cast `$nonce` to string in `wp_verify_nonce()`.
props jesin.
fixes #29542.

git-svn-id: https://develop.svn.wordpress.org/trunk@30576 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-26 19:18:02 +00:00
Gary Pendergast 0cb93dd166 When `json_encode()` returns a JSON string containing `'null'` in PHP 5.4 or earlier, `wp_json_encode()` will now sanity check the data, as older versions of PHP failed to encode non UTF-8 characters correctly, instead returning `'null'`.
Fixes #30471.


git-svn-id: https://develop.svn.wordpress.org/trunk@30561 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 05:00:36 +00:00
Jeremy Felt f1e5edee9a Add basic unit tests for `is_plugin_active_for_network()`
Props rodrigosprimo
Fixes #30491


git-svn-id: https://develop.svn.wordpress.org/trunk@30559 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 04:02:26 +00:00
Boone Gorges 4537217cf1 Add basic unit tests for `is_plugin_active()` and `is_plugin_inactive()`.
Props voldemortensen.
Fixes #30489.

git-svn-id: https://develop.svn.wordpress.org/trunk@30557 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-25 01:12:39 +00:00
Boone Gorges 7c8c493a9c Fix the unit tests for Imagick alpha.
These tests were written to use the `assertImageAtAlpha()` helper method, whose
internals were specific to GD. As a result, the tests could not pass. This
changeset introduces GD- and Imagick-specific versions of this method.

Props voldemortensen.
Fixes #24871.

git-svn-id: https://develop.svn.wordpress.org/trunk@30549 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 20:56:36 +00:00
Boone Gorges 951409119e Declare an explicit 'order' in `test_get_comments_by_user()`.
This change fixes broken builds on older versions of MySQL. See #30462.

Assertions regarding indeterminate secondary ORDER BY clauses will go in
separate test methods. See #30478.

git-svn-id: https://develop.svn.wordpress.org/trunk@30548 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 14:55:49 +00:00
Gary Pendergast fc2bec7a5e `json_encode()` returns different results for non UTF-8 strings in PHP 5.5+, versus earlier versions of PHP.
This fixes the unit tests that fail in earlier versions, see #30471 for fixing this globally in `wp_json_encode()`.


git-svn-id: https://develop.svn.wordpress.org/trunk@30534 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-24 01:55:42 +00:00
Gary Pendergast 33dcc948f5 Split the tests for `wp_json_encode()` into smaller chunks (let's all them "units"). Skip a couple of these tests when running on older versions of PHP that don't support the tested functionality.
See #28786.


git-svn-id: https://develop.svn.wordpress.org/trunk@30533 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 23:51:13 +00:00
Boone Gorges b7bcd40bac Remove failing `test_network_limit()` XML-RPC test.
Test added as a patch on #21292.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30530 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 01:22:15 +00:00
Boone Gorges e61c9fecbd Better rewrite rule flushing in `test_permalink_without_title()`.
This ensures that the test is not polluted by permalink structure changes in
earlier tests.

git-svn-id: https://develop.svn.wordpress.org/trunk@30529 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 01:19:04 +00:00
Boone Gorges b44106c380 Ensure that `wpdb_exposed_methods_for_testing` is available to all tests.
It should be defined in a common library file so that all tests have access to
it, even when run in isolation.

See [30345], #21212.

git-svn-id: https://develop.svn.wordpress.org/trunk@30528 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-23 00:46:50 +00:00
Boone Gorges 4992fdb95f Ensure `sanitize_user()` expected test values are lowercase on multisite.
[30524] neglected to account for the fact that multisite forces user logins to
lowercase.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30527 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 21:29:40 +00:00
Boone Gorges 96f9d84dba Stop checking Trac to skip tests against open tickets.
In general, skipped tests should live only in patches, which are committed at
the same time that the corresponding bug is fixed. In cases where it's
necessary to skip a test, use `markTestSkipped()` to declare this fact
explicitly.

We continue to check Trac when using `WP_UnitTestCase` to run non-core tests.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30526 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 21:10:12 +00:00
Boone Gorges ed426ef8ef Repair the `seems_utf8()` tests that use Big5 encoding.
* Provide sample data that is actually encoded in Big5.
* Do some actual assertions against that data.

Props akumria.
Fixes #30455.

git-svn-id: https://develop.svn.wordpress.org/trunk@30525 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:56:23 +00:00
Boone Gorges 9b6563f70f Remove failing test related to the 'offset' param of `WP_Query`.
This test has been added as a patch to #18897.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30524 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:45:58 +00:00
Boone Gorges 83a9ac46fe Remove failing test related to `wp_list_pages()`.
The test has been added as a patch to #27326.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30523 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:43:56 +00:00
Boone Gorges 086d0311fa Remove failing test related to `wp_unique_post_slug()`.
The test has been added as a patch to #18962.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30522 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:41:04 +00:00
Boone Gorges e102a22f80 Remove failing `is_textdomain_loaded()` test.
The removed test has been added as a patch to the original ticket, #21319.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30521 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:36:51 +00:00
Boone Gorges 05336f904f Remove failing assertions from `is_serialized()` tests.
They have been moved to new test methods, which have been attached as a patch
to the ticket #9930.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30520 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:34:15 +00:00
Boone Gorges 28b45922d5 Remove failing test in the `hooks` group.
The removed test has been added as a patch to #21169.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30519 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:25:03 +00:00
Boone Gorges 63f6864a9e Remove skipped tests for `WP_Export_Query`.
These tests have been added as a patch to the ticket where the new
functionality was originally proposed, #22435.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30518 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:22:01 +00:00
Boone Gorges 0b9a21b451 Remove skipped tests for unimplemented JS plural functions.
The tests have been added as a patch for the original ticket, #22229.

Props MikeHansenMe.
See #22229.

git-svn-id: https://develop.svn.wordpress.org/trunk@30517 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:11:10 +00:00
Boone Gorges d5b277e6bd Remove failing test for unimplemented `wp_mail()` enhancement.
The removed test has been added as a patch to the original ticket, #15448.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30516 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 20:05:34 +00:00
Boone Gorges 73ef6bd6fc Improvements to encoded character formatting tests.
In `sanitize_title_with_dashes()` and `sanitize_user()` tests, we break large
test methods into smaller ones in order to isolate those that actually describe
the bug being reported in ticket #10823. The unit tests that are continuing to
fail have been attached as a patch to that ticket.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30515 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 19:53:37 +00:00
Boone Gorges 3818c645c3 Remove failing tests related to square brackets being stripped in URL sanitizers.
These tests have been added as a patch to their original ticket, #16859.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30514 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:39:38 +00:00
Boone Gorges f0b8424483 Remove failing tests related to `WP_User::__unset()`.
These tests have been added as a patch to their original ticket, #20043.

Props MikeHansenMe.
See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30513 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:36:00 +00:00
Boone Gorges fa76c19ecb Declare user_email when setting up fixtures for `count_user_posts()` tests.
Because `setUpBeforeClass()` is called statically and creates its own factory
object, the iterator logic from previous tests is not carried over to these
fixtures, and we risk the possibility of user_email clashes when the tests are
run in certain limited configurations.

git-svn-id: https://develop.svn.wordpress.org/trunk@30512 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 15:04:07 +00:00
Boone Gorges cfeae751a0 Improve performance of post revision order test.
`test_revision_order()` was written ([28541], #26042) to ensure that revision
order was properly preserved in two different cases: (1) where the post_date
varied (in which case the revisions would be sorted by post_date DESC) and
(2) where the post_date was the same (in which case sorting would fall back on
ID DESC). In an attempt to ensure that both of these scenarios arose in the
context of a single test, 100 posts were created. We can make the process far
more efficient by manually creating the revisions with the post_dates
explicitly declared, and splitting the two different cases into two separate
test methods.

This test was previously the single worst offender in the entire suite, taking
upwards of 15 seconds to run. All that most maddens and torments; all that stirs
up the lees of things; all truth with malice in it; all that cracks the sinews
and cakes the brain; all the subtle demonisms of life and thought; all evil, to
crazy Boone, were visibly personified, and made practically assailable in
`test_revision_order()`.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30511 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 14:17:21 +00:00
Boone Gorges 36315d2b3f Remove some failing unit tests from the `post` group.
These tests have been added as a patch to ticket #19373.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30510 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-22 12:03:48 +00:00
Sergey Biryukov 917a469052 Replace invalid use of ltrim() in attachment_url_to_postid() with substr().
props bradyvercher.
fixes #30346.

git-svn-id: https://develop.svn.wordpress.org/trunk@30501 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-21 06:34:23 +00:00
Boone Gorges 5e71d5f21e Improve cleanup of cached term_ids after shared terms are split.
* If the split term ID is stored as 'default_category', 'default_link_category', or 'default_email_category', update it to the new ID.
* If the split term ID is associated with a nav menu item, update that piece of postmeta to the new ID.

Props mboynes.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30494 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-21 03:16:08 +00:00
John Blackbourn 8fe059d426 Correct an SQL syntax error introduced in r30158. Adds tests.
Fixes #30339
See #18962
Props julien731


git-svn-id: https://develop.svn.wordpress.org/trunk@30480 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:45:48 +00:00
Andrew Nacin 95dbca94e1 More tests for [30466]. props xknown.
git-svn-id: https://develop.svn.wordpress.org/trunk@30471 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:10:24 +00:00
Andrew Nacin aec2f2654e Prevent high resource usage when hashing large passwords. props mdawaffe, pento
git-svn-id: https://develop.svn.wordpress.org/trunk@30466 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 16:02:55 +00:00
Andrew Nacin fb28a78331 Anchor texturize to shortcodes to improve regex efficiency.
props miqrogroove.
see #29557 for segfault issues.


git-svn-id: https://develop.svn.wordpress.org/trunk@30449 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 14:27:08 +00:00
Andrew Nacin d2b4df2d4f Invalidate password keys when a user's email changes.
git-svn-id: https://develop.svn.wordpress.org/trunk@30430 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 13:39:03 +00:00
Jeremy Felt 3223d4a4b3 Prevent wpmu_delete_blog from removing the wrong uploads directory
`wp_upload_dir()` includes some logic to fall back to the default site's upload directory if a specific directory for the requested site cannot be found. Because of this, if `wpmu_delete_blog()` is fired twice in a row for the same site, the main site's upload directory could be deleted as well.

This adds some checks in `wpmu_delete_blog()` so that we are confident in the site and it's upload directory's existence before dropping the site. Tests are added for when `ms_files_rewriting` is enabled or disabled.

Fixes #30121


git-svn-id: https://develop.svn.wordpress.org/trunk@30404 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 06:52:07 +00:00
Boone Gorges 10b611b0c3 Return an empty array from `get_approved_comments()` when `$post_id` is empty.
This behavior was broken when moving the internals to `WP_Comment_Query` in
[30098]. As a result, `get_approved_comments( 0 )` was fetching *all* approved
comments, causing performance issues.

Props dd32.
Fixes #30412.

git-svn-id: https://develop.svn.wordpress.org/trunk@30402 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:51:38 +00:00
Gary Pendergast 78f496f378 Fix a MySQL warning in the `test_get_adjacent_post_exclude_self_term` unit test, caused by [30400].
See #21212, #22112.


git-svn-id: https://develop.svn.wordpress.org/trunk@30401 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:47:30 +00:00
Gary Pendergast cabcace53c WPDB: Force `STRICT_ALL_TABLES` to be enabled as soon as we connect to the MySQL server.
This improves data integrity when inserting and updating rows in the database, particularly when trying to insert emoji into posts stored with character sets that don't support emoji.

See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30400 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 01:45:10 +00:00
Andrew Ozz 7137f26a5b TinyMCE: update to the latest dev. version, 4.1.6+. Fixes #30411.
git-svn-id: https://develop.svn.wordpress.org/trunk@30397 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-20 00:49:38 +00:00
Boone Gorges c002bcf27e Better test method name in formatting/IsEmail.php.
Props dlh.
Fixes #30397.

git-svn-id: https://develop.svn.wordpress.org/trunk@30392 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-19 19:31:17 +00:00
Boone Gorges d1e841c03b Improvements to `wp_make_link_relative()`.
* Support relative URL input.
* When the URL being made relative has another URL as a parameter, don't make the second URL relative.

Props voldemortensen.
Fixes #30373.

git-svn-id: https://develop.svn.wordpress.org/trunk@30383 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-19 01:52:57 +00:00
Gary Pendergast de33d35d1f WPDB: When a `db.php` drop-in is being used, and it doesn't explicitly define itself as connecting to MySQL, skip the character set checks. This ensures that existing drop-ins won't accidentally run checks that they don't support.
See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30375 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-18 03:37:23 +00:00
Boone Gorges db2bd39770 Add unit test files mistakenly excluded from [30085].
See #9256, #25349.

git-svn-id: https://develop.svn.wordpress.org/trunk@30367 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-17 16:16:01 +00:00
Boone Gorges 69a167688e Flush cache for newly created term in `_split_shared_term()`.
The term itself does not have any cached values yet, but in some cases the new
term's taxonomy may need its cached hierarchy to be refreshed as a result of
the term splitting.

Props jorbin.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30347 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:52:23 +00:00
Gary Pendergast e1ca159011 If a saving a post fails, remove any invalid characters (such as emoji) from the primary text fields, then try to save it again.
See #21212.



git-svn-id: https://develop.svn.wordpress.org/trunk@30346 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:33:50 +00:00
Gary Pendergast 6df14c1612 When creating a post containing emoji, the post can be saved incorrectly if MySQL isn't using a character set that supports emoji.
This change prevents the save from occurring, so it can be handled correctly in the UI.

See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30345 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:27:17 +00:00
Boone Gorges ab96cf6614 Reinstate term splitting on term update.
Originally introduced in [30241] and reverted in [30336], term splitting is
back and better than ever. Now with *more unit tests* and *improved treatment
of child terms*!

See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30344 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-14 21:26:48 +00:00
Aaron Jorbin b94dd6a7ec When asserting microtime output as a number, make it a number
microtime is by default a string. Doing a greater then or less than check of that string is a bad idea since it uses the first part (the micro part of microtime) rather then the actual time. This adds a helper to convert microtime output into a float which we can then use to properly compare the output of microtime.

This fixes an intermittent test failure.

fixes #30336



git-svn-id: https://develop.svn.wordpress.org/trunk@30337 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 22:03:15 +00:00
boonebgorges 805021f406 Don't split shared terms on term update.
Splitting shared terms means assigning a new term_id to a given term_taxonomy_id.
It was uncovered that this change could cause problems for sites that have
cached the original term_id somehow - say, in postmeta - since future lookups
using that term_id will now fail.

Removing for 4.1-beta1. We'll look at improvements to backward compatibility
to try to get this back into a later beta.

Props mboynes.
See #30335.

git-svn-id: https://develop.svn.wordpress.org/trunk@30336 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 20:04:02 +00:00
Boone Gorges 3544e20e9a Introduce `$post_type` param for `count_user_posts()`.
Props Caspie, engelen, DrewAPicture.
Fixes #21364.

git-svn-id: https://develop.svn.wordpress.org/trunk@30322 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 02:18:30 +00:00
Boone Gorges f5d88c355e Manually delete fixture in `test_mysqli_flush_sync()`.
This test creates a dummy post and subsequently runs a query containing
`DROP PROCEDURE`. This latter query implies a `COMMIT`, which means that the
post is not cleaned up for later tests. Manually deleting the post with
`wp_delete_post()` solves this problem.

Fixes #28155.

git-svn-id: https://develop.svn.wordpress.org/trunk@30320 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-13 01:59:49 +00:00
Boone Gorges df11fb8593 Exclude external-http tests when running `phpunit`.
The external-http tests are very slow, and `Wp_Http` functionality is fairly
isolated, so the benefits of skipping these tests by default outweigh the
risks.

A `grunt phpunit:external-http` subtask has been added, to ensure that the
tests are executed during exhaustive runs of the test suite, such as in
continuous integration.

Fixes #30304.

git-svn-id: https://develop.svn.wordpress.org/trunk@30298 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 14:48:28 +00:00
Gary Pendergast 4b1aa89206 `wpdb::flush()` was not flushing results correctly when using mysqli.
This change also allows stored procedures or queries made with `mysqli_multi_query()` to be flushed.

Includes unit tests.

Fixes #28155.

Props soulseekah.


git-svn-id: https://develop.svn.wordpress.org/trunk@30297 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 05:39:50 +00:00
Boone Gorges 3c360968ef Fix PHP notice in `Tests_Feed_RSS2::test_items()`.
A notice was being thrown when `get_the_tags()` returned false, and `foreach()`
was run over that return value.

See [30283].

git-svn-id: https://develop.svn.wordpress.org/trunk@30295 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-10 02:04:22 +00:00
Aaron Jorbin 218924d9ee Remove failing Unbalanced tags tests
Patch with tests added to #6297 for use in the future

Props MikeHansenMe for creating patch of current unit test

see #30284


git-svn-id: https://develop.svn.wordpress.org/trunk@30291 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 23:14:28 +00:00
Aaron Jorbin 44825185f7 Remove failing shortcode unit tests
Test added to #14050 in case we want to include it in a future fix.

see #30284



git-svn-id: https://develop.svn.wordpress.org/trunk@30290 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 22:50:30 +00:00
Aaron Jorbin e7e27c2e4d Remove failing uploadfile test in trunk
The test has been added to #11946 and can be readded when that ticket is fixed.

Props MikeHansenMe for creating patch of current unit test

See #30284



git-svn-id: https://develop.svn.wordpress.org/trunk@30289 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:55:41 +00:00
Jeremy Felt 211c7ac373 Move tests for ms_files_rewriting to separate group, ms-files
When the `ms_files_rewriting` flag is enabled, `ms_upload_constants()` is required to properly set upload directory constants. Once this fires, it is impossible to clean up for a non `ms_files_rewriting` test by turning the option back off.

Excluding these tests by default offer a more consistent environment overall. Any tests written for uploaded files in multisite should ideally have a correspondign test in this area.

This commit also moves existing `ms_files_rewriting` tests for `test_switch_upload_dir()`.

Fixes #30256


git-svn-id: https://develop.svn.wordpress.org/trunk@30286 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:07:05 +00:00
Boone Gorges ffcfc0573b Remove failing test related to post galleries.
It relied on the old _WPDataset technique, which is no longer used.

The test has been added to #UT30 as a patch, in case anyone wants to make
future use of it.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30285 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 21:01:39 +00:00
Boone Gorges 9b425eb5e4 Improve `Tests_Feed_RSS2::test_items()`.
* Better reference to post author, to avoid PHP notices.
* Code styling.
* More reliable checking of tags and categories.

Props kurtpayne.
Fixes #UT32. See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30283 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:54:06 +00:00
Boone Gorges 13602b566d Remove failing unit tests from 'canonical' group.
Each removed test has been turned into a patch and posted to the open ticket
that it belongs to.

See #30284.

git-svn-id: https://develop.svn.wordpress.org/trunk@30282 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:36:27 +00:00
Jeremy Felt bcf340ff65 Use `remove_added_uploads()` in `tearDown()` for XMLRPC tests
This cleanup avoids false test failures due to incrementing filenames in the uploads directory.

Fixes #30290


git-svn-id: https://develop.svn.wordpress.org/trunk@30279 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 20:17:17 +00:00
Boone Gorges 608084a9cc In unit tests, use `wpmu_delete_user()` to delete users when `is_multisite()`.
`wp_delete_user()` doesn't remove the user from the database, which causes all
sorts of problems in certain cases.

Props jeremyfelt.
See [30277], #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30278 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 19:55:05 +00:00
Boone Gorges d63ceb08a3 Share fixtures across 'canonical' automated tests.
Sharing these fixtures results in a speed improvement of almost one minute per
run of the test suite.

My hope is that future WordPress developers will spend this extra minute with
their loved ones, for life on this earth is short, my friends, and the moments
you spend watching WP generate test data can never again be reclaimed from the
grizzled clutches of Time, and none of us are really getting younger, I mean,
geez, have you looked in the mirror lately, Gandalf?

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30277 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 19:28:12 +00:00
Boone Gorges fe726039bd Share fixtures across a number of query-related test classes.
This shaves 10-20 seconds off the running time for the suite.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30276 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-08 15:29:31 +00:00
Boone Gorges f12b0f9aad Correct variable name in `WP_UnitTestCase::temp_filename()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@30268 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-07 01:36:05 +00:00
Boone Gorges 73eee04d38 Unset the default permalink structure after installing Multisite for automated tests.
Most of our unit tests that involve permalinks expect non-pretty permalinks;
this is the default setting for WP. However, when the test suite installs
multisite, `populate_network()` is run before WP recogizes itself as multisite,
which leads to pretty permalinks being set. This breaks a number of unit
tests in ways that are difficult to trace.

git-svn-id: https://develop.svn.wordpress.org/trunk@30267 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-07 01:24:19 +00:00
Boone Gorges b09103c101 Use `assertEqualSets()` for some `WP_Comment_Query` tests.
git-svn-id: https://develop.svn.wordpress.org/trunk@30266 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 22:27:34 +00:00
Boone Gorges 642e826cd9 Don't force child_of=0 for non-hierarchical taxonomies in `get_terms()`.
This forcing appears to have been introduced to save unnecessary queries, but
(a) in some cases it appeared to be causing *more* queries, and (b) it caused
incorrect results when the 'exclude_tree' param of `get_terms()` called
`get_terms()` on each item in the tree using the 'child_of' param.

Fixes #30275.

git-svn-id: https://develop.svn.wordpress.org/trunk@30265 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 21:46:18 +00:00
Boone Gorges 11843fe460 Add tests for `get_adjacent_post_link()` wrappers.
Props MikeHansenMe.
See #29663.

git-svn-id: https://develop.svn.wordpress.org/trunk@30264 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 20:16:10 +00:00
Boone Gorges 6f7880bcf4 In `get_adjacent_post()`, `$excluded_terms` should check term_id rather than term_taxonom_id.
See #29663, #22112.

git-svn-id: https://develop.svn.wordpress.org/trunk@30263 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-06 20:11:34 +00:00
Boone Gorges 328de7115a Split shared taxonomy terms during term update.
When updating an existing taxonomy term that shares its `term_id` with
another term, we generate a new row in `wp_terms` and associate the updated
term_taxonomy_id with the new term. This separates the terms, such that
updating the name of one term does not change the name of any others.

Note that this term splitting only occurs on installations whose database
schemas have been upgraded to version 30133 or higher. Note also that shared
terms are only split when run through `wp_update_term()`, as on edit-tags.php;
we will wait until a future release of WordPress to force the splitting of all
shared taxonomy terms.

Props boonebgorges, rmccue, greuben, garyc40, wonderboymusic, imath, jesin.
Fixes #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30241 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-05 02:02:48 +00:00
Boone Gorges 88167ddc1a Do not create shared taxonomy terms.
A "shared" term occurs when two entries in the `wp_term_taxonomy` table share a
single `term_id`, and thereby correspond to the same row in `wp_terms`. This
changeset stops the practice of creating shared terms: each new row in
`wp_term_taxonomy` will receive its own row in `wp_terms`. The new strategy
for term creation depends on whether the installation's database schema is up
to date for 4.1:

* If so, terms are allowed to be created with the same slug as an existing term, as long as they are in different taxonomies and do not share a parent. Thus, a new tag with the slug 'wordpress' can exist alongside a category with the slug 'wordpress'.
* If not, new terms will be forced to have unique slugs. Thus, on an installation containing a category with the slug 'wordpress', a new tag 'WordPress' will get the slug 'wordpress-2'.

Fixes #21950. See #5809.

git-svn-id: https://develop.svn.wordpress.org/trunk@30240 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-05 01:41:58 +00:00
Boone Gorges 9c13546518 Introduce `term_template` param to `get_the_taxonomies()`.
This parameter allows theme and plugin authors to specify the formatting they
would like on the term links as they are parsed into the taxonomy list.

Props hereswhatidid, dlh, davidjlaietta.
See #27238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30209 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 18:48:42 +00:00
Boone Gorges 2b6df5f8ce Ignore case when checking string 'false' in `wp_validate_boolean()`.
Props TobiasBg, kitchin.
Fixes #30238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30207 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 15:54:42 +00:00
Boone Gorges 1219355f2b Add unit tests for `wp_validate_boolean()`.
Props TobiasBg.
See #30238.

git-svn-id: https://develop.svn.wordpress.org/trunk@30206 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 15:51:11 +00:00
Boone Gorges f744ee189e In `in_object_in_term()`, only check numeric string values against term_id.
The previous `in_array()` check was playing too loose with mixed types, such
that a string like '10_term_name' would incorrectly match a term_id 10.

Props nobinobi, realloc.
Fixes #29467.

git-svn-id: https://develop.svn.wordpress.org/trunk@30205 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 14:24:23 +00:00
Boone Gorges fc8da37358 Add some unit tests for `is_object_in_term()`.
These tests check a number of the ways that different kinds of values for
`$terms` (integers that match term_id, strings that match term_id or name or
slug) are handled.

See #29467.

git-svn-id: https://develop.svn.wordpress.org/trunk@30204 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-03 14:24:17 +00:00
Jeremy Felt 6f88946089 Improve layout of test for cached invalid, then valid site details
* Rename method to `test_get_blog_details_when_site_does_not_exist()`.
* Always assume `MAX(blog_id)` is 1 and therefore always create a burner.
* Remove tests specific to `wpmu_delete_blog()` and cache, to be handled elsewhere.
* Remove extra asertions.

See #30080, #23405


git-svn-id: https://develop.svn.wordpress.org/trunk@30175 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-02 01:04:47 +00:00
Jeremy Felt 85aa2ef76e Split tests for wp_get_sites()
Test various arguments for `wp_get_sites()` in a more intentful way rather than in one large test. Leave tests for limit and offset together for convenience.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30174 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 23:39:22 +00:00
Scott Taylor 9817ecd92e Remove failing unit test after [30090].
Fixes #30194.


git-svn-id: https://develop.svn.wordpress.org/trunk@30160 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 21:10:23 +00:00
Scott Taylor 4315c9c5c3 Allow `get_pages()`, with `child_of` passed to it, to work with interrupted hierarchies.
Adds unit test.
Fixes #18962.


git-svn-id: https://develop.svn.wordpress.org/trunk@30159 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 20:43:55 +00:00
Scott Taylor 59658c6547 All duplicate slugs across different post types.
Adds unit test.

Props mboynes, nacin.
Fixes #18962.


git-svn-id: https://develop.svn.wordpress.org/trunk@30158 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 20:36:23 +00:00
Jeremy Felt db68b57c14 Split tests for is_main_site()
Break multiple assertions from one method into multiple methods with one assertion each.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30152 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 05:17:17 +00:00
Jeremy Felt d0fa387002 Expand and clarify tests for get_blog_post()
Remove unnecessary user factory use. Be explicit about test scenarios.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30151 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 04:47:00 +00:00
Boone Gorges 262150a91e Clean up 'post-thumbnail' theme support unit tests.
* Separate into smaller test methods.
* Remove incorrect tests. A number of assertions in the existing test have always incorrectly described the behavior of `current_theme_supports( 'post-thumbnails' )`, but no one ever noticed because the tests had been designed to bail when `_wp_render_title_tag()` did not exist. The failures finally became visible when that function was introduced in [30074].

See #18548.

git-svn-id: https://develop.svn.wordpress.org/trunk@30148 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 04:00:59 +00:00
Boone Gorges 7c64b3b3dd Introduced `dayofweek_iso` time param for `WP_Date_Query`.
The initial `dayofweek` param sets day 1 to Sunday. This is out of step with
ISO standards, which calls Monday day 1. To maintain backward compatibility
with the existing parameter, we introduce the new `dayofweek_iso` for the
new, more compliant param.

Props mboynes.
Fixes #28063.

git-svn-id: https://develop.svn.wordpress.org/trunk@30142 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 03:23:15 +00:00
Boone Gorges d6b7b7aa41 Allow resource_type to be specified in `get_ancestors()`.
Being explicit about resource type (taxonomy vs post_type) allows for the
proper resolution of conflicts when a taxonomy and post_type share a slug.

Props filosofo.
Fixes #15029.

git-svn-id: https://develop.svn.wordpress.org/trunk@30141 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 02:57:31 +00:00
Boone Gorges 8dbaaf9927 Pass all updated meta IDs to filters in `update_metadata()`.
Props wonderboymusic.
Fixes #11683.

git-svn-id: https://develop.svn.wordpress.org/trunk@30140 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 02:38:19 +00:00
Scott Taylor bdf61ef6a0 Fix failing unit tests after [30096]: use `assertEqualSets()`.
git-svn-id: https://develop.svn.wordpress.org/trunk@30135 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 01:10:39 +00:00
Scott Taylor ff4f545fc9 [28785] introduced a bug, where encoded query arguments were decoded by `parse_str()` inside of `wp_parse_str()` but never re-encoded later on.
This encodes them, adds unit test.

Props obenland.
Fixes #29636.


git-svn-id: https://develop.svn.wordpress.org/trunk@30133 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 00:53:26 +00:00
Scott Taylor ef23aee2a6 Fix unit test for video shortcode after [30082].
Fixes #30078.


git-svn-id: https://develop.svn.wordpress.org/trunk@30132 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-01 00:48:32 +00:00
Boone Gorges be87d5daad Move `term_exists()` tests to their own file.
git-svn-id: https://develop.svn.wordpress.org/trunk@30118 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 18:52:37 +00:00
Boone Gorges 9a84da90c3 Unserialize `get_metadata()` results when 'key' is omitted.
Props mattkeys, nacin.
Fixes #15030.

git-svn-id: https://develop.svn.wordpress.org/trunk@30115 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 10:24:22 +00:00
Jeremy Felt cdc35000f9 Improve tests for domain_exists()
* Split existing tests for `domain_exists()` into many smaller tests.
* Make slightly fewer, more accurate assertions.
* Remove unnecessary site creation via factory.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30114 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 05:43:31 +00:00
Boone Gorges f59f32104a Streamline some `get_terms()` cache tests.
* Split large method into a number of smaller tests.
* Create fewer fixtures.

See #30017.

git-svn-id: https://develop.svn.wordpress.org/trunk@30113 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 04:15:03 +00:00
Boone Gorges df5e0a00b8 Clean up cache invalidation suspension global in unit tests.
This fixes a test that was introduced in [30073] which was polluting later
tests.

See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30112 602fd350-edb4-49c9-b593-d223f7449a82
2014-10-30 04:14:53 +00:00