Commit Graph

2507 Commits

Author SHA1 Message Date
Gary Pendergast ab5cd5011f Build/Test: Revert that failing test.
Now that Travis has confirmed that it is sending messages to Slack when a test fails, we no longer need a failing test.

The failing test added in [40613] is reverted, as Travis has failed to fail at notifying us about failing tests.

See #40712.



git-svn-id: https://develop.svn.wordpress.org/trunk@40614 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-11 00:15:05 +00:00
Gary Pendergast a301163c46 Build/Test: Add an intentionally failing test.
To ensure that Travis is sending messages to Slack, a test needs to fail, so here's a failing test.

This failing test (and no other failing tests) will be reverted once Travis confirms that it isn't failing to message Slack about failing tests.

See #40712.



git-svn-id: https://develop.svn.wordpress.org/trunk@40613 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 23:36:18 +00:00
Felix Arntz 9d2d5b536d Multisite: Adjust site count of the correct network after having created a new site.
Prior to this change, after creating a site, the network site count was always refreshed on the current network, regardless of whether the site was created on a different network. With the recent changes, particularly [40591], it is now possible to update the site count for a specific `$network_id`, so this changeset makes use of the new parameter.

Fixes #38699.


git-svn-id: https://develop.svn.wordpress.org/trunk@40612 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 23:21:43 +00:00
Felix Arntz 883c0b04a9 Multisite: Fix usage of incorrect `site_count` network option name in unit tests.
The unit tests introduced as part of [40486] used the wrong `site_count` network option name instead of `blog_count`. This did not cause actual issues in the tests, but deleting the option was supposed to verify that it is properly recreated afterwards. The usage of the wrong name made these tests less useful, so this changeset fixes it.

Fixes #40725.


git-svn-id: https://develop.svn.wordpress.org/trunk@40611 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 23:12:24 +00:00
Felix Arntz 1d1220d566 Multisite: Fix unstable unit test for `get_blog_count()`.
The unit test introduced in [40370] used the strict `assertSame()` check while comparison a count with the value of an option, which under most conditions is not an integer. While the test passed on some setups, it failed on others. This changeset ensures that `assertEquals()` is used to make the test stable.

Fixes #40724.


git-svn-id: https://develop.svn.wordpress.org/trunk@40610 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 23:02:42 +00:00
Andrew Ozz be2a26ab08 Dashboard: Update the existing WordPress News dashboard widget to also include upcoming meetup events and WordCamps near the current user’s location.
Props @afercia, @andreamiddleton, @azaozz, @camikaos, @coreymckrill, @chanthaboune, @courtneypk, @dd32, @iandunn, @iseulde, @mapk, @mayukojpn, @melchoyce, @nao, @obenland, @pento, @samuelsidler, @stephdau, @tellyworth.
See #40702.

git-svn-id: https://develop.svn.wordpress.org/trunk@40607 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 20:03:01 +00:00
James Nylen 0fab6c9fdc REST API: Add `author`, `modified`, and `parent` sort order options for posts.
These (and a few others that can be revisited later if needed) were present in
beta versions of the WP REST API but were removed during the merge to WP 4.7.

Props ChopinBach, jnylen0.
Fixes #38693.


git-svn-id: https://develop.svn.wordpress.org/trunk@40605 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 18:51:28 +00:00
Ryan McCue faa6386ca0 REST API: Include featured_media in embed responses.
Props kadamwhite, jnylen0, westonruter.
Fixes #39805.


git-svn-id: https://develop.svn.wordpress.org/trunk@40602 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 04:45:10 +00:00
Ryan McCue 292a871e44 REST API: Set global $post when preparing revisions.
For compatibility with filters on hooks on content filters (such as shortcodes), we need to set the global. This mirrors the Posts controller.

Props pdufour, jnylen0.
Fixes #40626.


git-svn-id: https://develop.svn.wordpress.org/trunk@40601 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-10 04:31:28 +00:00
Jeremy Felt 0dd638a2e7 Multisite: Check only valid looking emails against banned domain list.
If an email address is missing an `@`, we can't assume enough to check it against a list of domain names.

Additional validation of email should happen in `is_email()` before being passed to `is_email_address_unsafe()`.

Fixes #39915.


git-svn-id: https://develop.svn.wordpress.org/trunk@40595 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-09 16:54:52 +00:00
Jeremy Felt 3e9c46812c Multisite: Validate email before checking against banned domains.
Previously, an invalid email could result in an undefined index when attempting to determine the email domain.

Props ocean90.
See #39915.


git-svn-id: https://develop.svn.wordpress.org/trunk@40594 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-09 16:32:53 +00:00
Felix Arntz 1515787d31 Multisite: Add `$network_id` parameter to `wp_is_large_network()`.
Now that `get_blog_count()` and `get_user_count()` both support passing a `$network_id` parameter (see [40370] and [40371]), similar functionality is now available for `wp_is_large_network()`. In addition, the filter `wp_is_large_network` now accepts the network ID as its fourth parameter.

This changeset furthermore introduces unit tests for the `wp_is_large_network()` function and its filter.

Fixes #40489.


git-svn-id: https://develop.svn.wordpress.org/trunk@40590 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-09 15:50:04 +00:00
Felix Arntz 48661c4b00 Multisite: Introduce `minimum_site_name_length` filter.
Prior to this change, the minimum site name length checked in `wpmu_validate_blog_signup()` was set to a fixed value of 4. The new filter allows tweaking this value, as there may be cases where shorter site names may be required.

Fixes #39676.


git-svn-id: https://develop.svn.wordpress.org/trunk@40589 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-09 14:58:39 +00:00
Andrew Ozz 656718a645 Fix linting errors in tinymce-obsolete.js.
See #40690.

git-svn-id: https://develop.svn.wordpress.org/trunk@40585 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-08 06:05:39 +00:00
Andrew Ozz 1727d6fbef TinyMCE: remove the pre-4.6.0 tests. Move regression testing for obsolete tags and attributes to the default QUnit tests.
See #40690.

git-svn-id: https://develop.svn.wordpress.org/trunk@40584 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-08 05:35:41 +00:00
John Blackbourn 45b183ea79 Users: Correct a permission check when showing the User item in the `+ New` admin toolbar menu.
Props dlh
Fixes #39252


git-svn-id: https://develop.svn.wordpress.org/trunk@40581 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-07 17:41:24 +00:00
Joe Hoyle cc661013cf REST API: WP_REST_Request::remove_header() should canonicalize header names.
When headers are stored in WP_REST_Request internally they are canonicalized. This step already happens on setting / getting headers in any way, but was missed when implementing remove_header().

Props TimothyBlynJacobs.
Fixes #40347.


git-svn-id: https://develop.svn.wordpress.org/trunk@40577 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-07 04:08:42 +00:00
John Blackbourn c759785cea Build/Test Tools: Automatically skip tests in the `ms-required` and `ms-excluded` groups.
This removes the need to manually call `$this->skipWithMultisite()` and `$this->skipWithoutMultisite()` from within the test when the test only runs without Multisite or only runs on Multisite, respectively.

Props jdgrimes for the suggestion.

Fixes #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40564 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-01 20:34:10 +00:00
John Blackbourn f72ce6dc6e Users: Add two missing special cases to the capability tests for non-logged-in users.
Also updates a `expectedIncorrectUsage` notation.

See #37405


git-svn-id: https://develop.svn.wordpress.org/trunk@40563 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-01 16:18:19 +00:00
John Blackbourn 46fab9de51 Build/Test Tools: Add object-cache.php to the unit test suite.
This removes an unnecessary external dependency from the Travis tests.

Fixes #40619


git-svn-id: https://develop.svn.wordpress.org/trunk@40561 602fd350-edb4-49c9-b593-d223f7449a82
2017-05-01 11:20:30 +00:00
John Blackbourn c2fd41759c Users: Ensure user counts remain accurate if users are added to or removed from the `users` table without corresponding `usermeta` entries being added or removed.
This has a slight performance impact on sites with a large number of users when the `time` strategy is used for counting users. Hopefully this impact will be negated by enhancements proposed in #38741.

Props psoluch, dots, boonebgorges, ptbello, tharsheblows

Fixes #29785


git-svn-id: https://develop.svn.wordpress.org/trunk@40560 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-30 13:02:50 +00:00
John Blackbourn 7c1d20422f Posts, Post Types: Revert [40558] pending investigation.
See #18375


git-svn-id: https://develop.svn.wordpress.org/trunk@40559 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-30 11:18:43 +00:00
John Blackbourn 0940f8396c Posts, Post Types: Correct the attachment post type template unit test introduced in [38951].
Also adds additional assertions for the templates.

See #18375


git-svn-id: https://develop.svn.wordpress.org/trunk@40558 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-29 21:15:34 +00:00
Boone Gorges 7c4248b5e0 Fix broken `check_comment()` test.
The test `Tests_Comment_CheckComment::test_should_return_true_when_content_does_not_match_moderation_keys()`
did not, in fact, test for a `true` value, but for a false one.
Switching to `assertTrue()` caused a failure, because the test comment
triggered the 'comment_moderation' test. As in other tests in the file,
the solution is to force 'comment_moderation' to 0 for the purposes of
the test.

Introduced in [32519].

Props stephdau.
Fixes #40584.

git-svn-id: https://develop.svn.wordpress.org/trunk@40557 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-27 16:22:36 +00:00
John Blackbourn 626547e9cf Feeds: Remove an incorrect usage of `sizeof()` in a helper class used during unit testing of XML element handling.
This also helps tidy up the test output when running PHP 7.2.

See #40109


git-svn-id: https://develop.svn.wordpress.org/trunk@40555 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-24 01:22:39 +00:00
John Blackbourn 4602012570 REST API: Remove a useless unit test.
See #35907, #38373


git-svn-id: https://develop.svn.wordpress.org/trunk@40545 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 22:19:29 +00:00
John Blackbourn a16ada6d31 Build/Test Tools: Remove more unnecessary test skipping when erroneous situations occur.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40544 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 22:11:52 +00:00
John Blackbourn 64f8351da1 Build/Test Tools: Introduce `skipWithoutMultisite()` and `skipWithMultisite`() methods into the test suite.
This brings much needed uniformity to test skipping when a test requires Multisite or when a test should be excluded from running when Multisite is enabled.

Used in conjunction with the `@group ms-required` and `@group ms-excluded` notation, this removes a significant number of skipped tests from the default test suite run.

Fixes #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40543 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 21:57:31 +00:00
John Blackbourn e3a9d87083 Build/Test Tools: More tweaks to the deprecated calls assertion. This needs to be triggered when there are unexpected deprecated calls or wrongdoings too.
See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40542 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 21:34:37 +00:00
John Blackbourn 21ce4e90d3 Build/Test Tools: Only perform an assertion for deprecated calls and wrongdoings if any are expected.
This avoids masking risky tests that don't otherwise perform an assertion.

See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40541 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 21:28:44 +00:00
John Blackbourn f5bf5ba8b8 Build/Test Tools: Move the `setExpectedException()` method into the `WP_Ajax_UnitTestCase` class to avoid a fatal error when PHPUnit 3.6 is in use.
This needs more investigation but it gets the test suite on PHP 5.2 passing again.

See #39822


git-svn-id: https://develop.svn.wordpress.org/trunk@40539 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 11:45:46 +00:00
John Blackbourn ce8a915c06 Build/Test Tools: Add support for PHPUnit 6+.
This adds a compatibility shim for the new namespaced structure of PHPUnit and the removed `setExpectedException()` method. In addition, this updates the Travis config so PHPUnit 6.1 is used where appropriate.

Props miyauchi, gitlost.

Fixes #39822


git-svn-id: https://develop.svn.wordpress.org/trunk@40536 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 02:05:12 +00:00
John Blackbourn 208a5dd57f Build/Test Tools: Ensure that `WP_UnitTestCase::expectedDeprecated()` performs an assertion to avoid risky test notices.
See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40535 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 01:44:13 +00:00
John Blackbourn a5a1a4d20e Build/Test Tools: Be strict about tests that do not test anything.
See #40538


git-svn-id: https://develop.svn.wordpress.org/trunk@40534 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-23 01:24:41 +00:00
John Blackbourn c0910cd442 Build/Test Tools: Remove unnecessary checks and skips that should instead cause failures if they ever fail.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40533 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 22:54:15 +00:00
John Blackbourn 669bd1bbc3 Build/Test Tools: Convert more test skipping into hard failures. These dependencies should all be present when testing.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40532 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 22:11:56 +00:00
John Blackbourn 446189eac7 Build/Test Tools: Convert more test skipping into hard failures. These dependencies should all be present when testing.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40531 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 22:00:15 +00:00
John Blackbourn b060b7e503 Build/Test Tools: Correct an incorrect `ms-` group name.
See #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40530 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 21:43:13 +00:00
John Blackbourn 583e7a41bc Build/Test Tools: Partially revert [40524].
See #40533, #40535


git-svn-id: https://develop.svn.wordpress.org/trunk@40529 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 21:21:30 +00:00
John Blackbourn f017338460 Build/Test Tools: Don't trigger a skipped test when the built version of `wp-embed.min.js` isn't present.
The grunt command assertion prior to the check for the existence of the file is enough to safeguard this test.

See #34698, #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40526 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 20:17:49 +00:00
John Blackbourn d4effd5d6b Build/Test Tools: Replace test skipping with actual assertions when dealing with the `DISALLOW_UNFILTERED_HTML`, `DISALLOW_FILE_MODS`, and `DISALLOW_FILE_EDIT` constants.
If any of these constants are set during testing, they should cause the tests to fail, not to be skipped, otherwise we have a situation where failure conditions are never seen.

See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40525 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 20:12:29 +00:00
John Blackbourn 950b185aa7 Build/Test Tools: Remove more skipped tests that should actually be failures if their conditions aren't satisfied.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40524 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 19:42:12 +00:00
John Blackbourn b987aa93a7 Build/Test Tools: Remove ancient UT ticket handling.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40523 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 19:38:42 +00:00
John Blackbourn caf86dc849 Build/Test Tools: Add some more tests to the `ms-required` and `ms-excluded` groups.
See #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40522 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 19:21:11 +00:00
John Blackbourn 021dce3aa2 Build/Test Tools: Remove a useless test.
See #33898, #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40521 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 19:09:09 +00:00
John Blackbourn 4f8057f7d5 Build/Test Tools: Introduce `ms-required` and `ms-excluded` groups for tests.
Tests in the `ms-excluded` group are now excluded when running tests with multisite enabled, and tests in the `ms-required` group are excluded when running tests without multisite enabled. The end result is a significantly reduced number of skipped tests polluting PHPUnit's output, which means verbose mode can be used to more easily see which tests are skipped or incomplete, and why.

See #40531


git-svn-id: https://develop.svn.wordpress.org/trunk@40520 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 18:58:46 +00:00
John Blackbourn c717bfbba9 Build/Test Tools: Don't skip tests when php.net or dev.mysql.com are unreachable.
This sort of behaviour subtly hides the fact that these tests will never fail if the URLs where version number information is fetched from go away for one reason or another.

See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40519 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 18:44:18 +00:00
John Blackbourn 040b411ec2 Build/Test Tools: Avoid skipping canonical tests that are connected to open Trac tickets.
This is a remnant of the test suite behaviour before #30284 fixed most of it and makes it far too easy to hide failing tests.

If any tests begin to fail as a result of this change then they should be fixed.

Fixes #40534


git-svn-id: https://develop.svn.wordpress.org/trunk@40518 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 18:25:30 +00:00
John Blackbourn 2eb8cb7ca2 Canonical: Don't skip tests if the test data is invalid.
See #40533


git-svn-id: https://develop.svn.wordpress.org/trunk@40517 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-22 17:29:03 +00:00
Boone Gorges ccd942ddaa Restore support for taxonomy 'args' override when querying object terms.
[7520] introduced an undocumented feature whereby developers could
register a custom taxonomy with an 'args' parameter, consisting of
an array of config params that, when present, override corresponding
params in the `$args` array passed to `wp_get_object_terms()` when
using that function to query for terms in the specified taxonomy.

The `wp_get_object_terms()` refactor in [38667] failed to respect
this secret covenant, and the current changeset atones for the
transgression.

Props danielbachhuber.
Fixes #40496.

git-svn-id: https://develop.svn.wordpress.org/trunk@40513 602fd350-edb4-49c9-b593-d223f7449a82
2017-04-21 19:13:51 +00:00