Commit Graph

961 Commits

Author SHA1 Message Date
John Blackbourn 389fb33d76 Skip the `Tests_Option_Transient::test_nonexistent_key_old_timeout()` tests on multisite for now.
See #31130
Fixes #30380


git-svn-id: https://develop.svn.wordpress.org/trunk@33125 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 18:23:46 +00:00
ocean90 94e3540dcc Update PHPMailer to 5.2.10 from 5.2.7.
Includes two modifications for WordPress:
* Removes support for NTLM in `class-smtp.php` since the required client (`extras/ntlm_sasl_client.php`) is not distributed as part of WordPress.
* Requires `class-smtp.php` for backwards compatibility with direct (non-wp_mail()) uses of PHPMailer, as the autoloader isn't used. See [27385].

This also includes a change to our `MockMailer` for unit tests. It now overrides `postSend() instead of `send()`, and `preSend()`.
`preSend()` resets `$this->Encoding` because PHPMailer doesn't clean up after itself / presets all variables. This becomes an issue when `PHPMailer::createBody()` sets `$this->Encoding = 'quoted-printable'` (away from it's default of 8bit) when it encounters a line longer than 998 characters. `Tests_Comment::test_comment_field_lengths` is such a case.

props MattyRob, dd32.
fixes #28909.

git-svn-id: https://develop.svn.wordpress.org/trunk@33124 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 17:15:02 +00:00
Aaron Jorbin 08d5df5f44 Remove PHP4 constructors from Unit Tests
If you are subclassing these classes in your own tests, you'll need to update your code.

Props johnbillion
See #31982



git-svn-id: https://develop.svn.wordpress.org/trunk@33123 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 16:04:11 +00:00
Weston Ruter bde076cbfb Customizer: Prevent preview from loading during QUnit tests and causing an XHR cross-domain error.
Fixes #32666.


git-svn-id: https://develop.svn.wordpress.org/trunk@33120 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 05:37:37 +00:00
John Blackbourn 0888ce55b1 Introduce unit tests for `sanitize_option()`.
Props MikeHansenMe, welcher, johnbillion
See #32351


git-svn-id: https://develop.svn.wordpress.org/trunk@33119 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-08 00:05:17 +00:00
John Blackbourn 063637755b Allow shortcode parameter names (attributes) to contain dashes.
Props aaroncampbell, tyxla, izem
Fixes #9405


git-svn-id: https://develop.svn.wordpress.org/trunk@33118 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 23:58:49 +00:00
Scott Taylor 138d68a58a In `wp_insert_user()`, comparing an email address against the user's old email address should not be case-sensitive.
Adds unit tests.

Props tyxla.
Fixes #32158.


git-svn-id: https://develop.svn.wordpress.org/trunk@33115 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 19:28:46 +00:00
Dominik Schilling (ocean90) daa477e3b8 Transients: If `get_option( $transient_timeout )` returns false, don't bother trying to delete the transient in `get_transient()`.
props jamesgol, ericmann.
fixes #30380.

git-svn-id: https://develop.svn.wordpress.org/trunk@33110 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 16:44:08 +00:00
Boone Gorges 8e6997b652 Use `assertEqualSets()` in `WP_Query::parse_tax_query()` tests.
Props ocean90.
See #32454.

git-svn-id: https://develop.svn.wordpress.org/trunk@33102 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-07 00:57:04 +00:00
Konstantin Obenland 2cafc0d787 Check for all required caps before (un)sticking a post.
In cases where a user has the `edit_others_posts` capability but not
`publish_posts`, it was possible for that user to unstick a post after editing,
since the input field was never made available in that context.

Props ericmann, chriscct7.
Fixes #24153.



git-svn-id: https://develop.svn.wordpress.org/trunk@33096 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 22:40:59 +00:00
Boone Gorges 53021ef6fe In `WP_Query::parse_tax_query()`, allow taxonomy querystring to be formatted as an array.
Props Veraxus.
Fixes #32454.

git-svn-id: https://develop.svn.wordpress.org/trunk@33095 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 20:36:18 +00:00
Weston Ruter 1b02636793 Customizer: Ensure that a newly-added nav menu item gets the Original link populated in its control.
Props valendesigns.
Fixes #32858.



git-svn-id: https://develop.svn.wordpress.org/trunk@33089 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-06 05:52:59 +00:00
Jeremy Felt 14f39faab1 Usernames in multisite should be restricted to 60 characters or fewer.
Only 60 characters can be stored in the database for a username, which could cause lookup issues when attempting to use similar usernames of extreme length.

Props @DJPaul.
See #17904, Fixes #26784.


git-svn-id: https://develop.svn.wordpress.org/trunk@33083 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-04 05:52:46 +00:00
Weston Ruter a21c6e76d6 Customizer: Fix saving menus with empty names or names that are already used.
Adds validation for initially-supplied nav menu name, blocking empty names from being supplied. If later an empty name is supplied and the nav menu is saved, the name "(unnamed)" will be supplied instead and supplied back to the client. If a name is supplied for the menu which is currently used by another menu, then the name conflict is resolved by adding a numerical counter similar to how `post_name` conflicts are resolved. Includes unit tests.

Fixes #32760.



git-svn-id: https://develop.svn.wordpress.org/trunk@33071 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-03 20:46:48 +00:00
Aaron Jorbin a547d6fed1 Don't strip newline in esc_url() when protocol is mailto:
The mailto protocol is a bit different than the other protocols in that new lines are something you might realistically want to include. Includes tests to make sure that http protocol urls that contain mailto: aren't affected. Tests for stripping newlines in general already exist.

Fixes #31632
Props danielbachhuber



git-svn-id: https://develop.svn.wordpress.org/trunk@33064 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-03 14:27:11 +00:00
Sergey Biryukov 8a8fc13bd0 Update `test_filter_wp_nav_menu_args()` after [33035].
see #32781.

git-svn-id: https://develop.svn.wordpress.org/trunk@33043 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-02 01:17:58 +00:00
Konstantin Obenland efdce1da51 Turn of comments for pages by default.
Pages are static content, for which comments are not expected out of the box.

Props valendesigns, rachelbaker.
Fixes #31168.



git-svn-id: https://develop.svn.wordpress.org/trunk@33041 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-02 00:21:28 +00:00
Dominik Schilling (ocean90) caab22e5b2 l10n: Update `wp_get_installed_translations()` to support variants of a language.
* A variant of a language has its own locale, for example the locale of the formal variant of German is `de_DE_formal`.
* Update `remove_accents()` and some CSS rules to support `de_DE_formal`.
* Add tests for `get_bloginfo( 'language' )`.
* API changes will be deployed over the next few days.

see #28303.

git-svn-id: https://develop.svn.wordpress.org/trunk@33027 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 15:42:32 +00:00
Boone Gorges f7b8ff5a2e Don't allow `$field` param to be passed to `get_term_link()`.
The new parameter creates inconsistencies in the signatures of the various
functions for fetching term links (`get_term_feed_link()`,
`get_edit_term_link()`, etc.).

Reverts [32553].

See #14156.

git-svn-id: https://develop.svn.wordpress.org/trunk@33022 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 12:53:05 +00:00
Boone Gorges e8a16ec322 Allow 'comment_agent' and 'comment_author_IP' to be set via `wp_new_comment()`.
Props mrutz, wonderboymusic, rachelbaker.
Fixes #14601.

git-svn-id: https://develop.svn.wordpress.org/trunk@33021 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 12:07:28 +00:00
Dion Hulse 5b58664439 Expire password reset links after 24 hours (by default). This causes existing password reset links to become invalid.
Props markjaquith, voldemortensen, johnbillion, MikeHansenMe, dd32
See #32429


git-svn-id: https://develop.svn.wordpress.org/trunk@33019 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 06:32:07 +00:00
Andrew Ozz 58f914004d TinyMCE: update to 4.2.1. Changelog: https://github.com/tinymce/tinymce-dist/blob/master/changelog.txt.
Fixes #32801.

git-svn-id: https://develop.svn.wordpress.org/trunk@33013 602fd350-edb4-49c9-b593-d223f7449a82
2015-07-01 00:51:22 +00:00
Boone Gorges 3a982b1590 Fix `Tests_Post_GetPostClass::test_taxonomy_classes_hit_cache()` after [32994].
[32994] results in an additional database query during automated testing, so
the query count being compared in this specific test must be incremented
manually.

See #16434.

git-svn-id: https://develop.svn.wordpress.org/trunk@32997 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 14:31:52 +00:00
Boone Gorges 10d81a3fe5 Introduce 'wp_generate_tag_cloud_data' filter.
This filter allows developers to modify the data that is used to create tag
clouds, without having to manipulate the tag cloud markup directly.

As part of the refactor, this changeset also adds a few unit tests for the way
`wp_generate_tag_cloud()` generates the 'title' attribute, as well as
improvements to output escaping.

Props flixos90, ysalame.
Fixes #24656.

git-svn-id: https://develop.svn.wordpress.org/trunk@32996 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 14:15:59 +00:00
Boone Gorges 85ce3f7eba Add some tests for `wp_generate_tag_cloud()`.
Props welcher.
See #24656.

git-svn-id: https://develop.svn.wordpress.org/trunk@32995 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-29 13:18:48 +00:00
Aaron Jorbin 4a60647ab7 Deprecate php4 style constructors
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors.  The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).

This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used.  In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."

Upstream: https://wiki.php.net/rfc/remove_php4_constructors

Props jdgrimes, netweb, jorbin
See #31982



git-svn-id: https://develop.svn.wordpress.org/trunk@32990 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-28 15:26:41 +00:00
Scott Taylor a796d187b3 When searching for users using the `search` arg in `get_users()`/`WP_User_Query`, also search the user's email, url, and display name.
Adds unit tests.

Props mordauk, wonderboymusic.
Fixes #27304.


git-svn-id: https://develop.svn.wordpress.org/trunk@32980 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-28 00:35:42 +00:00
Boone Gorges 4f60683623 Improve error checking in `get_edit_term_link()`.
The function should not throw notices when an improper term or taxonomy is
passed.

Props tmatsuur, MikeHansenMe.
Fixes #32786.

git-svn-id: https://develop.svn.wordpress.org/trunk@32954 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-26 14:12:27 +00:00
Boone Gorges da5c716009 Introduce `WP_UnitTestCase::delete_user()`.
This static method provides a multisite-agnostic way to delete users during
automated testing.

See #32796.

git-svn-id: https://develop.svn.wordpress.org/trunk@32953 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-26 12:58:29 +00:00
Scott Taylor dcd5b25395 After [32896], update `ConvertChars.php` unit tests and rename to `ConvertInvalidEntries.php`.
Props boonebgorges.
Fixes #32335.


git-svn-id: https://develop.svn.wordpress.org/trunk@32947 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-25 19:50:14 +00:00
Scott Taylor ac63fb4dc3 YouTube oEmbed parsing: support the `m` subdomain.
Adds unit tests.

Props Toru, johnbillion.
Fixes #32714.


git-svn-id: https://develop.svn.wordpress.org/trunk@32930 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 21:05:59 +00:00
John Blackbourn 447550ec7b Implement tests for the `upload_mimes` filter to ensure it prevents the upload of disallowed file types.
See #32693


git-svn-id: https://develop.svn.wordpress.org/trunk@32919 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 00:42:33 +00:00
John Blackbourn 8c22c526bd Implement canonical and `url_to_postid()` tests for child pages which share a post name with other child pages.
See #32759


git-svn-id: https://develop.svn.wordpress.org/trunk@32918 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-24 00:40:45 +00:00
Boone Gorges 2399de6870 Add `expectedDeprecated` flags to `wp_richedit_pre()` and `wp_htmledit_pre()` unit tests.
These functions were deprecated in [32899].

See #32425.

git-svn-id: https://develop.svn.wordpress.org/trunk@32912 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-23 14:41:39 +00:00
Boone Gorges 641e701865 In `WP_Comment_Query`, parse meta_query vars after the `pre_get_comments` hook.
[31467] included a change that involved generating meta_query SQL before the
`pre_get_comments` hook, with the result that `pre_get_comments` callbacks were
no longer able to modify comment meta queries. We fix the problem by moving the
SQL generation to after the hook.

This changeset also includes a second call to `meta_query->parse_query_vars()`,
to ensure that modifications to metadata-related query vars (such as `meta_key`
and `meta_value`) performed in `pre_get_comments` callbacks have the expected
effect on the comment query.

Fixes #32762.

git-svn-id: https://develop.svn.wordpress.org/trunk@32911 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-23 14:35:29 +00:00
Scott Taylor 9d0fe3958c After [32884], update the default value for `comment_shortcuts`.
Props dlh, rachelbaker, DrewAPicture.
Fixes #31588.


git-svn-id: https://develop.svn.wordpress.org/trunk@32904 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-22 20:43:58 +00:00
Scott Taylor ed8b9a8d27 `wptexturize()` improvements:
* Make sure that strings ending with a number and quotation mark get the proper smart quotes
* Introduce `wptexturize_primes()`, a logic tree to determine whether or not "7'." represents seven feet, then converts the special char into either a prime char or a closing quote char.

Adds unit tests.

Props miqrogroove.
Fixes #29256.


git-svn-id: https://develop.svn.wordpress.org/trunk@32863 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 20:05:52 +00:00
Scott Taylor a06f5f6d90 Don't strip `\0` (backslash+zero) from post content for users without "unfiltered_html"
Adds unit tests.

Props miqrogroove.
Fixes #28699.


git-svn-id: https://develop.svn.wordpress.org/trunk@32860 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 18:46:11 +00:00
Ella Iseulde Van Dorpe fa5ec5077b Editor: restructure word count
* The WordCounter should only do one thing: count words. This makes it also easier to test.
* Add some really basic unit tests.
* Instead of only refreshing the count on enter and delete, refresh the count when the user stops typing. Also look at paste and content changes in TinyMCE.
* Use `match` instead of `replace` when it is appropriate.
* More readable code.

See #30966. Fixes #26620.



git-svn-id: https://develop.svn.wordpress.org/trunk@32856 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 10:34:59 +00:00
Andrew Ozz 5cb9a4b019 Fix using `htmlspecialchars()` whit the `$double_encode` parameter. PHP < 5.4 doesn't validate the entities.
Props miqrogroove. Fixes #17780.

git-svn-id: https://develop.svn.wordpress.org/trunk@32851 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-19 01:52:48 +00:00
Scott Taylor 4d8c4295f3 Since PHP 5.2.3, the `htmlspecialchars()` function has an optional `$double_encode` parameter, which we can now use. This will save us a few expensive kses/html decoding calls.
Adds unit tests.

Props miqrogroove.
Fixes #17780.


git-svn-id: https://develop.svn.wordpress.org/trunk@32850 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 21:59:10 +00:00
Boone Gorges d7831ec94d Use `assertFalse()` rather than `assertNull()` in `Tests_WP_Customize_Setting::test_is_current_blog_previewed()`.
`is_current_blog_previewed()` returns a boolean.

See #31428.

git-svn-id: https://develop.svn.wordpress.org/trunk@32840 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 14:07:35 +00:00
Boone Gorges 9597066674 Make sure `$_SERVER['SERVER_NAME']` is set whenever `wp_mail()` is called in PHPUnit tests.
This eliminates PHP notices when `wp_mail()` needs to determine its own From header.

See [25381] for a previous fix, which focused only on the mail-specific tests.

Fixes #32702.

git-svn-id: https://develop.svn.wordpress.org/trunk@32839 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 13:52:29 +00:00
Ella Iseulde Van Dorpe fa1a214eb6 TinyMCE: wptextpattern: fix issue that removes content
* If the resulting text node is empty, don't remove all the content from the paragraph.
* If there's an empty text node at the start of the paragraph, ignore it and consider the next node to be the start.

See #31441.


git-svn-id: https://develop.svn.wordpress.org/trunk@32832 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-18 11:33:11 +00:00
John Blackbourn c98a9dd6d7 Correct a unit test name.
See #21212


git-svn-id: https://develop.svn.wordpress.org/trunk@32826 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-17 23:09:28 +00:00
John Blackbourn afd6dd79fe Comprehensive unit tests for every available capability, and for all roles.
Fixes #32394.


git-svn-id: https://develop.svn.wordpress.org/trunk@32812 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-17 00:04:08 +00:00
Dominik Schilling (ocean90) c0a66eba79 Add menu management to the Customizer.
This brings in the Menu Customizer plugin: https://wordpress.org/plugins/menu-customizer/.

props celloexpressions, westonruter, valendesigns, voldemortensen, ocean90, adamsilverstein, kucrut, jorbin, designsimply, afercia, davidakennedy, obenland.
see #32576.

git-svn-id: https://develop.svn.wordpress.org/trunk@32806 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 22:07:08 +00:00
Boone Gorges 8235387ee4 Clean up uploaded file after `test_media_handle_upload_sets_post_excerpt()`.
Props McGuive7.
Fixes #32534.

git-svn-id: https://develop.svn.wordpress.org/trunk@32794 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 12:37:30 +00:00
Scott Taylor 1e8fb99ebd Improve the consistency of punctuation matching in `wptexturize()`.
Adds unit tests.

Props miqrogroove.
Fixes #31886.


git-svn-id: https://develop.svn.wordpress.org/trunk@32789 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:49:45 +00:00
Scott Taylor 40bb9aa3d9 Allow 'Cockney' filter to be translated.
Updates unit test.

Props miqrogroove.
Fixes #31953.


git-svn-id: https://develop.svn.wordpress.org/trunk@32788 602fd350-edb4-49c9-b593-d223f7449a82
2015-06-16 00:45:49 +00:00