Commit Graph

675 Commits

Author SHA1 Message Date
Boone Gorges 5f1ad2d768 In `wp_update_term()`, limit duplicate slug checks to the same taxonomy as the updated term.
In 4.1 [30240], `wp_insert_term()` was modified to allow the creation of terms
with duplicate slugs, as long as the terms are in different taxonomies.
`wp_update_term()` didn't get the corresponding modification, with the result
that term updates fail when the term being updated shares a slug with an older
term, regardless of that older term's taxonomy.

Props ipm-frommen.
Fixes #30780 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@30985 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-22 15:32:59 +00:00
Boone Gorges fd4231c2a1 Use correct notation for global functions in `@covers` test annotations.
Props sgrant.
Fixes #30769.

git-svn-id: https://develop.svn.wordpress.org/trunk@30976 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-19 15:20:41 +00:00
Boone Gorges b824d6f56c Update individual term caches in `get_terms()`.
This was removed in [29915] as part of the attempt to add cache support to
`get_term_by()`. When that support was removed in [30900], it was not properly
restored.

This changeset includes a unit test to verify that the cache is properly primed
for terms found in `get_terms()`, as well as tests to verify the other cache
setting that was touched by [30900].

Fixes #30749. See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30954 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-17 16:38:44 +00:00
Dominik Schilling (ocean90) e7f2ebf414 Customizer: Add more QUnit tests to improve coverage on the new models.
Includes tests for the broken `activate()`/`deactivate()` methods, which were fixed in [30871].

props westonruter.
see #30701.

git-svn-id: https://develop.svn.wordpress.org/trunk@30919 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-16 19:43:22 +00:00
Boone Gorges bf62165353 Remove caching for `get_term_by()` calls.
The new cache group scheme causes term invalidation to be overly broad, so
that busting the cache for one term will bust the cache for all terms in the
taxonomy. We'll have another go at more focused use of the 'last_changed'
incrementor in a future release.

Reverts [29915], [30073], [30080], [30108], [30112].
See #21760.

git-svn-id: https://develop.svn.wordpress.org/trunk@30900 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-16 13:26:19 +00:00
John Blackbourn 4f35288dd1 Add tests which ensure the `wp_editor_set_quality` and `jpeg_quality` filters only apply if they are added before the corresponding `WP_Image_Editor` is instantiated.
Props DH-Shredder
See #29856


git-svn-id: https://develop.svn.wordpress.org/trunk@30873 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-15 21:24:21 +00:00
Boone Gorges 093de0f0be In `WP_Meta_Query`, interpret 'value' correctly when used with EXISTS/NOT EXISTS.
As in earlier versions, EXISTS with a value is equivalent to '=', while NOT
EXISTS should always ignore 'value'.

Props barrykooij.
Fixes #30681 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@30846 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-14 19:00:31 +00:00
Jeremy Felt 0ae462657d Clean up factory arguments in ms-sites group.
* Arguments for user, path, and title are only necessary when we need to do something with those arguments later. Most cases in the ms-sites group do not require them.
* In `test_get_blog_id_from_url_is_case_insensitive()`, we should pass a lowercase domain argument.
* A user factory in `test_switch_restore_blog()` is not necessary.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30786 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 02:32:53 +00:00
Jeremy Felt a4c7261823 Split current tests for `update_blog_status()`
The current tests for `update_blog_status()` mirrored the tests for `update_blog_details()` in many ways and can be split in the same way. A noticeable difference is that the the matching actions fire even when no change is made to a field.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30785 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 02:14:21 +00:00
Jeremy Felt 7a8bceabaa Split current tests for `update_blog_details()`
The current tests for `upload_blog_details()` were focused on the actions fired whenever a site is marked as spam, archived, deleted, or matured. This breaks those into individual sections with fewer assertions per test.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30784 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-08 01:43:31 +00:00
Boone Gorges 98d17497d2 In `WP_Query::get_queried_object()`, use the new format for referencing tax query clauses.
`queried_terms`, rather than `queries`, is the tax_query property where a flat
index of terms is stored.

See [29901] for a similar fix in `redirect_canonical()`. See #29738.

Props dd32.
Fixes #30623.

git-svn-id: https://develop.svn.wordpress.org/trunk@30771 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-07 14:57:53 +00:00
Mark Jaquith 71bb091cc3 Revert [28719] and no longer math-process multiplication of negative numbers
see #19308
fixes #30445
props rmccue

git-svn-id: https://develop.svn.wordpress.org/trunk@30752 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-06 21:23:12 +00:00
Scott Taylor e37fb988b1 Give up on making uninterrupted hierarchies work in `get_page_children()` for now, reverts [30159], [30246], [30636].
Props boonebgorges.
See #14477.


git-svn-id: https://develop.svn.wordpress.org/trunk@30735 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-04 00:23:47 +00:00
Jeremy Felt 6213bb9689 Split tests for `get_blog_id_from_url()`
Breaks the many assertions for `get_blog_id_from_url()` into individual tests.

See #30080


git-svn-id: https://develop.svn.wordpress.org/trunk@30719 602fd350-edb4-49c9-b593-d223f7449a82
2014-12-03 05:51:33 +00:00
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