Commit Graph

28 Commits

Author SHA1 Message Date
Jonathan Desrosiers e26394bb2d General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48121 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 17:24:34 +00:00
Sergey Biryukov cfc3b57488 Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
2020-01-29 00:43:23 +00:00
Sergey Biryukov 85c7a64791 Docs: Improve `@return` description for `wp_update_comment()` and `WP_UnitTest_Factory_For_Comment::update_object()`.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@47017 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-27 00:28:39 +00:00
Sergey Biryukov 079580a6b7 Tests: Set `network_id` instead of `site_id` in `WP_UnitTest_Factory_For_Blog` defaults.
Follow-up to [47011], [47013].

See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47014 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-26 00:25:20 +00:00
Sergey Biryukov 93eeb8f1d7 Tests: Update legacy arguments passed to `WP_UnitTest_Factory_For_Blog::create_object()`.
This converts the arguments originally meant for `wpmu_create_blog()` to the ones used by `wp_insert_site()`.

Follow-up to [47011].

Fixes #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47013 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 21:39:46 +00:00
Sergey Biryukov ebe75fb903 Tests: Switch `WP_UnitTest_Factory_For_Blog::create_object()` to use `wp_insert_site()`.
Map some arguments for backward compatibility with `wpmu_create_blog()` previously used there.

Props davidbaumwald, danielbachhuber, jeremyfelt, SergeyBiryukov.
See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47011 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-25 18:10:19 +00:00
Sergey Biryukov 0d81dcbfb1 Docs: Add `@method` notation for `WP_UnitTest_Factory_For_Term::create_and_get()` for consistency with other factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46986 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:24:03 +00:00
Sergey Biryukov a3e674d4f9 Docs: Various documentation fixes for unit test factories.
See #48303.

git-svn-id: https://develop.svn.wordpress.org/trunk@46985 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-18 00:17:54 +00:00
Sergey Biryukov de38dfdd47 Tests: Make sure network factory returns an integer ID for created objects, for consistency with other factories and the documented value.
See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46831 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 11:29:14 +00:00
Sergey Biryukov 102cb95559 Tests: Pad incrementors used in factories with leading zeros to make sure MySQL sorting works as expected.
Previously, tests could create sequential objects with names like `Term 99`, `Term 100`, which by default would be returned in reverse order when sorted by name alphabetically, causing seemingly random test failures that are extremely hard to debug.

See #48145.

git-svn-id: https://develop.svn.wordpress.org/trunk@46830 602fd350-edb4-49c9-b593-d223f7449a82
2019-12-09 10:39:39 +00:00
Sergey Biryukov f29fdab426 Coding Standards: Fix WPCS issue in [46262].
See #47952.

git-svn-id: https://develop.svn.wordpress.org/trunk@46266 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 19:28:43 +00:00
John Blackbourn f3a268f58c Build/Test tools: Ensure the `create_and_get()` factory method returns the appropriate WP_Error when creating a term fails.
Fixes: #47952 


git-svn-id: https://develop.svn.wordpress.org/trunk@46262 602fd350-edb4-49c9-b593-d223f7449a82
2019-09-23 18:54:16 +00:00
Sergey Biryukov 1bfa9370f7 Build/Test Tools: Add missing access modifiers to factory classes in `phpunit/includes/factory`.
Props andizer.
Fixes #46504.

git-svn-id: https://develop.svn.wordpress.org/trunk@44903 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-15 12:15:08 +00:00
Aaron Jorbin e421f262dc Replace usages of basename() with wp_basename() in order to support multibyte filenames
This is focused on the pieces of code that touch media files and the tests that support them. `basename` isn't multibyte compatible out of the box. See http://php.net/basename and https://bugs.php.net/bug.php?id=62119.

See #43170.
Props Viper007Bond.


git-svn-id: https://develop.svn.wordpress.org/trunk@44785 602fd350-edb4-49c9-b593-d223f7449a82
2019-03-01 20:57:26 +00:00
Gary Pendergast ae62335191 Docs: Add docblocks for the PHPUnit factory objects.
Props andizer.
Fixes #44521.


git-svn-id: https://develop.svn.wordpress.org/trunk@44497 602fd350-edb4-49c9-b593-d223f7449a82
2019-01-09 05:43:14 +00:00
Gary Pendergast a75d153eee Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.



git-svn-id: https://develop.svn.wordpress.org/trunk@43571 602fd350-edb4-49c9-b593-d223f7449a82
2018-08-17 01:50:26 +00:00
Gary Pendergast 8f95800d52 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.



git-svn-id: https://develop.svn.wordpress.org/trunk@42343 602fd350-edb4-49c9-b593-d223f7449a82
2017-11-30 23:09:33 +00:00
Drew Jaynes 626f78750b Tests: Add `@method` notations to factor class DocBlocks as a way to indicate expected return types from factory methods for the benefit of IDEs.
Props jdgrimes.
Fixes #37867.


git-svn-id: https://develop.svn.wordpress.org/trunk@40968 602fd350-edb4-49c9-b593-d223f7449a82
2017-06-30 04:35:39 +00:00
Jeremy Felt 459fe129a5 Multisite: Use `get_network()` in `WP_UnitTest_Factory_For_Network`.
`wp_get_network()` was deprecated in 4.6.

Props johnjamesjacoby.
Fixes #38602.


git-svn-id: https://develop.svn.wordpress.org/trunk@39071 602fd350-edb4-49c9-b593-d223f7449a82
2016-11-01 16:51:26 +00:00
Jeremy Felt b6969df877 Multisite: Use `get_site()` in tests where `get_blog_details()` is not tested.
Remaining tests either rely on the `blog-details` cache key or test `get_blog_details()` itself.

Props flixos90.
Fixes #38497.


git-svn-id: https://develop.svn.wordpress.org/trunk@38935 602fd350-edb4-49c9-b593-d223f7449a82
2016-10-25 23:03:15 +00:00
Boone Gorges 74b912705d Tests: Fix incorrect variable name from [38330].
See #37630.

git-svn-id: https://develop.svn.wordpress.org/trunk@38331 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-23 13:48:13 +00:00
Boone Gorges b93e0739a9 Tests: Attachment `create()` method should match signature of other `create()` methods.
Legacy argument format continues to be accepted.

Props bcole808.
See #37630.

git-svn-id: https://develop.svn.wordpress.org/trunk@38330 602fd350-edb4-49c9-b593-d223f7449a82
2016-08-23 13:42:36 +00:00
Boone Gorges ec53bf5bf6 Add tests for `get_bookmarks()` cache.
This changeset adds a unit test factory so that bookmark/link fixtures can be
created during tests.

Why are we writing tests for functionality that has been deprecated for years?
Because it's the Right Thing to Do.

See #18356.

git-svn-id: https://develop.svn.wordpress.org/trunk@37563 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-25 18:20:24 +00:00
Jeremy Felt 4429638da6 Tests: Set `public` to `1` in the default blog factory
When no `$meta` arguments are passed to `wpmu_create_blog()`, `public` is set to `0` in the database for new sites. This is fine, but also does not match the default implied when most sites are created via `site-new.php`.

The only current use of the `$meta` argument in the tests is to (re)mark `public` as `0`. All existing tests pass with this change. Tests for `WP_Site_Query` can now rely on better default expectations.

See #36566.


git-svn-id: https://develop.svn.wordpress.org/trunk@37418 602fd350-edb4-49c9-b593-d223f7449a82
2016-05-11 19:21:22 +00:00
Boone Gorges 7c79386135 Tests: Use the same incrementor for all fields belonging to a given text fixture.
[35244] changed the way that `WP_UnitTest_Generator_Sequence()` created an
incrementor for object fields (like 'post_name' and 'user_email'), by making
incrementor static across the entire run of the test suite. While this helped
to enforce uniqueness across the tests, it has the side effect of bumping the
incrementor between fields on the same object (so that, eg, the same post might
have `post_name` "post-12" but `post_title` "Post 13". By switching to a
technique that uses the same incrementor for each field belonging to a given
fixture, we conform better to the expectations of developers using
`WP_UnitTest_Factory`.

Fixes #35199.

git-svn-id: https://develop.svn.wordpress.org/trunk@37299 602fd350-edb4-49c9-b593-d223f7449a82
2016-04-22 14:35:52 +00:00
ericlewis 59c8ba7871 Build/Test Tools: Document PHP unit test classes.
Props boonebgorges.
Fixes #35494.


git-svn-id: https://develop.svn.wordpress.org/trunk@36854 602fd350-edb4-49c9-b593-d223f7449a82
2016-03-05 19:47:41 +00:00
Eric Andrew Lewis 8d562e0d04 Build/Test Tools: Move class `WP_UnitTest_Factory` into its own file.
In [36347] we moved all PHP factory classes into their own files except the main class. The main class is now in its own file, and `factory.php` is solely an include manifest for all factory classes.


git-svn-id: https://develop.svn.wordpress.org/trunk@36409 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-27 03:26:15 +00:00
Eric Andrew Lewis d36d6cc630 Build/Test Tools: Move PHP factory classes into their own files.
This makes the code easier to browse.

`factory.php` loads the new files, so this is backwards compatible in case `factory.php` is loaded directly for access to one of the classes.

See #35492.


git-svn-id: https://develop.svn.wordpress.org/trunk@36347 602fd350-edb4-49c9-b593-d223f7449a82
2016-01-19 03:55:19 +00:00