Commit Graph

645 Commits

Author SHA1 Message Date
Gary Pendergast c00ba04e9c WPDB: Remove the addition of `STRICT_ALL_TABLES`, added in [30400]. This proved to be incompatible with too many plugins, as well as being incompatible with MySQL 5.7.
See #21212.


git-svn-id: https://develop.svn.wordpress.org/trunk@30587 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-27 10:59:10 +00:00
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