Commit Graph

661 Commits

Author SHA1 Message Date
Dominik Schilling (ocean90) abe2a7ae21 Customizer: Move private helper functions to `wp.customize.utils` so they can be unit tested.
Includes unit tests.

props ryankienstra, westonruter.
see #28709.

git-svn-id: https://develop.svn.wordpress.org/trunk@30716 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 22:55:48 +00:00
Jeremy Felt a23c468ac8 Split and improve multisite tests for upload quota
Break a single test with many assertions into many tests with single assertions.

In the process, provide separate and comprehensive tests for `upload_is_user_over_quota()`, `is_upload_space_available()`, and `get_space_allowed()`.

Also removes a check for `BLOGSUPLOADDIR`, a constant that never existed. New tests will need to be introduced to handle the ms-files group.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30715 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 22:55:30 +00:00
Gary Pendergast 9528294613 Unit Tests: The `test_set_allowed_incompatible_sql_mode()` test tries to set the `NO_ZERO_DATE` sql mode, which was removed in MySQL 5.7. This causes the test to incorrectly fail when run against MySQL 5.7.
git-svn-id: https://develop.svn.wordpress.org/trunk@30704 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 05:11:49 +00:00
John Blackbourn 5cda7d6aed Update the tests for `get_metadata()` to reflect the revert in r30701.
See #15030


git-svn-id: https://develop.svn.wordpress.org/trunk@30702 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 03:43:17 +00:00
Gary Pendergast 34f8e4d433 WPDB: When looking up the character set for a table or column, make sure we send the table name to MySQL in the correct case, as MySQL can be configured with case sensitive table names.
Fixes #30538.


git-svn-id: https://develop.svn.wordpress.org/trunk@30699 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-02 02:59:36 +00:00
Boone Gorges 50386cafd5 Use `assertEqualSetsWithIndex()` as appropriate in `get_terms()` tests.
See #30522.

git-svn-id: https://develop.svn.wordpress.org/trunk@30688 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 14:24:43 +00:00
Gary Pendergast 897b1645bb Unit Tests: The `assertEqualSets()` helper was returning true for some sets that were not equal. `assertEqualSets()` now behaves correctly, and the new `assertEqualSetsWithIndex()` helper also checks that the array indexes are the same.
Fixes #30522.


git-svn-id: https://develop.svn.wordpress.org/trunk@30687 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 05:01:29 +00:00
John Blackbourn cedecf8033 Allow brackets in a URL when it's sanitised for a redirect. Brackets are valid in query parameters.
Fixes #30308
Props voldemortensen


git-svn-id: https://develop.svn.wordpress.org/trunk@30684 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 03:20:13 +00:00
John Blackbourn b57c4ae165 Allow square brackets in a URL when it's sanitised for a redirect. Square brackets are valid in query parameters and IPv6 addresses.
Fixes #17052
Props voldemortensen


git-svn-id: https://develop.svn.wordpress.org/trunk@30683 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-01 03:15:24 +00:00
Andrew Ozz 45f4403dd0 TinyMCE: update to 4.1.7, changelog: https://github.com/tinymce/tinymce/blob/master/changelog.txt. Fixes #30560.
git-svn-id: https://develop.svn.wordpress.org/trunk@30675 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 23:27:23 +00:00
Scott Taylor 35708f61f8 Use `round()` instead of `floor()` when resizing image dimensions.
Updates unit tests.

Props SergeyBiryukov, kitchin.
Fixes #18532.


git-svn-id: https://develop.svn.wordpress.org/trunk@30660 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 19:53:18 +00:00
Scott Taylor 653485e87f `wp_upload_dir()` has a (little-known?) side effect: if you call it, it will attempt to create an uploads directory for the current month. As such, `tearDown()` and cleanup routines have to be in sync with this behavior when deleting bogus directories used in unit tests.
Examples: if you clean up directories in a test, or a test fails before the directories are cleaned, or a test fails before the `'upload_path'` option is reset, the next call to `wp_upload_dir()` will recreate the directories you just tried to delete.

These changes ensure that `src/foo` and `/tmp/wp-unit-test` directories are deleted immediately after `wp_upload_dir()` is fired in the tests. 
 
Fixes #30513.


git-svn-id: https://develop.svn.wordpress.org/trunk@30658 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 19:05:52 +00:00
Scott Taylor a411918199 Adjust the RegEx in `wp_check_filetype()` to be aware that query strings are thing that exist sometimes in URLs.
Adds unit tests.

Props voldemortensen.
Fixes #30377.


git-svn-id: https://develop.svn.wordpress.org/trunk@30640 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 06:32:16 +00:00
Scott Taylor b59b9f466a Fix edge-case in media cropping where selection and destination are the same size.
Adds unit tests.

Props mboynes.
Fixes #19793.


git-svn-id: https://develop.svn.wordpress.org/trunk@30639 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 06:26:26 +00:00
Gary Pendergast ea89b1c942 WPDB Unit Tests: Fix a fatal error that occurs in the `test_strip_invalid_text()` test if the `mbstring` extension isn't activated in PHP.
git-svn-id: https://develop.svn.wordpress.org/trunk@30631 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 05:35:00 +00:00
John Blackbourn 76a9abd7a7 Check attachments as well as the current post type when checking for duplicate post slugs. This avoids creating a page with a slug which conflicts with an existing attachment (the inverse is already handled).
Updates the existing test for pages which should take priority over attachments in cases where an existing clash exists.

Fixes #18962
Props boonebgorges


git-svn-id: https://develop.svn.wordpress.org/trunk@30629 602fd350-edb4-49c9-b593-d223f7449a82
2014-11-30 04:48:54 +00:00
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