44442 Commits

Author SHA1 Message Date
John Blackbourn
8f3d2b46ad Site Health: Standardise site health check status message punctuation.
Fixes #53594


git-svn-id: https://develop.svn.wordpress.org/trunk@51519 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-30 19:37:54 +00:00
John Blackbourn
4205214eba Docs: Replace $this in hook param docs with more appropriate names.
`$this` is a pseudo-variable that cannot be used as the name of a function parameter, so renaming these helps prevent errors when implementing hook callback functions.

Fixes #53457


git-svn-id: https://develop.svn.wordpress.org/trunk@51518 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-30 19:34:39 +00:00
Sergey Biryukov
17fb93149b Code Modernization: Fix "JsonSerializable_Object::jsonSerialize() should be compatible with JsonSerializable::jsonSerialize(): mixed" error on PHP 8.1.
This relates to the [https://wiki.php.net/rfc/internal_method_return_types Return types for internal methods RFC] in PHP 8.1 and in particular, the change made in [https://github.com/php/php-src/pull/7051 PHP PR #7051], which adds a `mixed` return type to the `JsonSerializable::jsonSerialize()` interface method.

WordPress only contains one (test) class which implements the `JsonSerializable` interface and this commit fixes the issue for that class.

As of PHP 8.1, the `jsonSerialize()` method in classes which implement the `JsonSerializable` interface are expected to have a return type declared. The return type should be `mixed` or a more specific type. This complies with the Liskov principle of covariance, which allows the return type of a child overloaded method to be more specific than that of the parent.

The problem with this is that:
1. The `mixed` return type was only introduced in PHP 8.0.
2. Return types in general were only introduced in PHP 7.0.

WordPress still has a minimum PHP version of 5.6, so adding the return type is not feasible for the time being.

The solution chosen for now is to add an attribute to silence the deprecation warning. While attributes are a PHP 8.0+ feature, due to the choice of the `#[]` syntax, in PHP < 8.0, attributes will just be ignored and treated as comments, so there is no drawback to using the attribute.

Props jrf.
See #53635.

git-svn-id: https://develop.svn.wordpress.org/trunk@51517 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-30 14:46:30 +00:00
John Blackbourn
108d4d1ae5 Docs: Add missing documentation for the minute parameter of WP_Query.
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51514 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-30 10:52:39 +00:00
John Blackbourn
ccbfd22833 Docs: Correct the documented allowed range for the minute and second parameters of WP_Query.
These are correctly documented and validated in `WP_Date_Query` as 0-59.

See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51513 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-30 10:22:11 +00:00
Jonathan Desrosiers
12a820379a Build/Test Tools: Revert the test and coding standards changes in [51511].
These were temporary for testing Slack messages when GitHub Action workflows fail.

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51512 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-29 20:02:53 +00:00
Jonathan Desrosiers
7a60b8eb8b Build/Test Tools: Post a message to #core in Slack when a workflow fails.
This adds an additional step to each GitHub Action workflow file that posts a message to #core in Slack every time a workflow run fails.

A minor test and spacing change is included in this commit in order to that messages are posted correctly and will be reverted after testing.

See #52644.

git-svn-id: https://develop.svn.wordpress.org/trunk@51511 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-29 19:47:43 +00:00
Sergey Biryukov
2905c5a9bc Themes: Add "Template Editing" to the list of WordPress theme features.
Follow-up to [meta11158].

Props poena, desrosj.
Fixes #53556. See #meta5802.

git-svn-id: https://develop.svn.wordpress.org/trunk@51510 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-29 14:46:48 +00:00
gziolo
ad976addb3 Build: Split packages and blocks to their webpack configs
It aligns with the changes proposed added in Gutenberg: https://github.com/WordPress/gutenberg/pull/33293.

The idea here is to split the growing webpack config into two parts: blocks and  packages.

We need to add handling for JavaScript files that are going to be used with blocks on the frontend. They didn't work quite well with the current setup for entry points created for packages.

As part of the effort, it adds support for `viewScript` in `block.json` metadata file that is later translated to `$view_script` in `WP_Block_Type` class and exposed as `view_script` from the REST API endpoint for block types.

Props youknowriad, desrosj, aristath.
Fixes #53690.



git-svn-id: https://develop.svn.wordpress.org/trunk@51501 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-28 10:05:01 +00:00
Sergey Biryukov
31c328d990 Networks and Sites: Replace two remaining occurrences of "blog" with "site" in user-facing strings.
Follow-up to [36386], [36416], [36417], [46213].

Props audrasjb.
Fixes #53775.

git-svn-id: https://develop.svn.wordpress.org/trunk@51500 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-28 10:00:51 +00:00
Jonathan Desrosiers
e6ed1b2be9 Coding Standards: Apply some alignment fixes from composer format.
Follow up to [51475].

See #53729.

git-svn-id: https://develop.svn.wordpress.org/trunk@51499 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 19:00:54 +00:00
Jonathan Desrosiers
ba98780ed5 Build/Test Tools: Remove the check for changes to version-controlled files in the Test Old Branch workflow.
This workflow does not perform a `git checkout` and is only used to dispatch workflows for old branches, so this check is not needed here.

Fixes #53799.

git-svn-id: https://develop.svn.wordpress.org/trunk@51498 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 14:10:44 +00:00
Jonathan Desrosiers
82e4df4cce Upgrade/Install: Add files for 5.8 to the $_old_files list that were missed.
Follow up to [51133], [51459].

Props WFMattR, audrasjb, ocean90, johnbillion, pbiron.
Fixes #53702.

git-svn-id: https://develop.svn.wordpress.org/trunk@51497 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 13:56:54 +00:00
Sergey Biryukov
38891dbbcb Bundled Themes: Remove extra trailing spaces from translatable strings in block patterns.
Follow-up to [49583], [51045].

Props audrasjb, mukesh27.
Fixes #53774.

git-svn-id: https://develop.svn.wordpress.org/trunk@51496 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 11:26:23 +00:00
Sergey Biryukov
3207c62104 Docs: Clarify the @return value for WP_Filesystem_Base::getnumchmodfromh().
Follow-up to [9117], [51494].

See #53399.

git-svn-id: https://develop.svn.wordpress.org/trunk@51495 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 11:00:25 +00:00
Sergey Biryukov
7bb0a17b46 Docs: Correct @return type for WP_Filesystem_Base::getnumchmodfromh().
Follow-up to [9117].

Props ankitmaru, johnbillion.
Fixes #53793.

git-svn-id: https://develop.svn.wordpress.org/trunk@51494 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-27 09:27:51 +00:00
Sergey Biryukov
8a0b871a3d Tests: Rename classes in phpunit/tests/widgets/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491], [51492].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51493 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-26 19:25:09 +00:00
Sergey Biryukov
7f828b6b00 Tests: Rename classes in phpunit/tests/sitemaps/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969], [51491].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51492 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-26 19:09:41 +00:00
Sergey Biryukov
1d838a7885 Tests: Rename classes in phpunit/tests/blocks/ per the naming conventions.
https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization

Follow-up to [47780], [48911], [49327], [50291], [50292], [50342], [50452], [50453], [50456], [50967], [50968], [50969].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51491 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-26 18:45:48 +00:00
Sergey Biryukov
9da818a068 Tests: Move and fix incorrectly placed tests for block supported styles.
The `Block_Supported_Styles_Test` class is not a `TestCase` to be extended, but an actual concrete test class. In order to run as expected, it should be placed under `phpunit/tests/blocks/` along with the other block tests.

Additionally:
* Add missing visibility keywords to test methods.
* Update the expected results to the currently used format for the tests to pass.
* Remove two outdated tests. The functionality being tested there is no longer available in this manner, so these tests are redundant.

Follow-up to [49226], [49310].

Props jrf, aristath, youknowriad.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51490 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-26 17:39:53 +00:00
Peter Wilson
000068f637 Bundled Themes: Version Bump 2010, 2011 and 2012.
Version bump three bundled themes to avoid file not found and fatal errors introduced for child themes during the 5.8 release cycle.

* Twenty Ten: Version 3.5 (fatal error & 404)
* Twenty Eleven: Version 3.9 (404)
* Twenty Twelve: Version 3.5 (404)

These updates will be released mid 5.8.1 cycle due to the severity of the issues.

Follow up to [51482,51483].

Props dd32, peterwilsoncc.
Fixes #53777.



git-svn-id: https://develop.svn.wordpress.org/trunk@51486 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-26 03:13:19 +00:00
Sergey Biryukov
9ea5645ec2 Media: Check the posts_per_page value in wp_ajax_query_attachments() before using it as a divisor.
This avoids a "Division by zero" PHP warning if a plugin changes the `posts_per_page` value to zero.

Follow-up to [51145].

Props 2linctools, kapilpaul, audrasjb.
Fixes #53773.

git-svn-id: https://develop.svn.wordpress.org/trunk@51485 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-25 09:55:33 +00:00
Sergey Biryukov
301eb3c8f6 Media: Remove unused code from wp-admin/includes/media.php.
Folow-up to [7043], [7062].

Props rudlinkon, hellofromTonya.
Fixes #53764.

git-svn-id: https://develop.svn.wordpress.org/trunk@51484 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-24 13:02:29 +00:00
Sergey Biryukov
c696a2f773 Bundled Themes: Use correct path for loading images in block patterns.
By using `get_template_directory_uri()` instead of `get_stylesheet_directory_uri()`, we make sure to include the images from the parent theme.

This avoids displaying missing images in block patterns when using a child theme of Twenty Ten, Twenty Eleven, or Twenty Twelve.

Follow-up to [51033], [51103], [51106].

Props audrasjb.
Fixes #53769.

git-svn-id: https://develop.svn.wordpress.org/trunk@51483 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-24 12:40:28 +00:00
Sergey Biryukov
bedd023c3a Twenty Ten: Use correct path for loading block patterns.
By using `get_template_directory()` instead of `get_stylesheet_directory()`, we make sure to include the `block-patterns.php` file from the parent theme.

This avoids a PHP fatal error when using a child theme of Twenty Ten.

Follow-up to [51106].

Props ryelle, sabernhardt, loranrendel.
Fixes #53752.

git-svn-id: https://develop.svn.wordpress.org/trunk@51482 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-23 13:12:31 +00:00
Sergey Biryukov
2c0a1f7377 Tests: Use better assertions in WP_UnitTestCase_Base::assertEqualFields():
* Check if the object attribute exists before checking its value.
* Mention the field name in error messages in case of failure.

Follow-up to [51478], [51479], [51480].

Props jrf.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51481 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 18:49:24 +00:00
Sergey Biryukov
d8c3bc78a1 Tests: Modernize the WP_UnitTestCase_Base::assertEqualFields() method:
* Use `assertSame()` instead of `fail()` to display a proper message in case of failure.
* Add an optional `$message` parameter for consistency with other assertions.

Follow-up to [51478], [51479].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51480 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 17:39:03 +00:00
Sergey Biryukov
dc568b181b Tests: Correct placement of the $message parameter in assertDiscardWhitespace().
Follow-up to [51478].

Props johnbillion.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51479 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 17:26:00 +00:00
Sergey Biryukov
0975e828f7 Tests: Add a $message parameter for custom assertions in WP_UnitTestCase_Base.
All assertions in PHPUnit have a `$message` parameter. Setting this parameter allows to distinguish which assertion is failing when a test runs multiple assertions, making debugging of the tests easier.

This optional parameter is now added for the assertion methods in the `WP_UnitTestCase_Base` class that were missing it.

Props jrf.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51478 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 17:14:44 +00:00
John Blackbourn
0871a0ddc2 Docs: Miscellaneous docblock corrections and improvements.
See #53399


git-svn-id: https://develop.svn.wordpress.org/trunk@51477 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 16:53:59 +00:00
Sergey Biryukov
a5bef1ea91 Tests: Correct class name for WP_Filesystem_Base::find_folder() tests.
A concrete test class should be suffixed with `Test`, not `UnitTestCase(s)`.

Follow-up to [25053].

Props jrf.
See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51476 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 16:44:34 +00:00
Sergey Biryukov
41df21e70d Docs: Add a comment about the $title global usage in various admin files.
This should make it clear that the variable is used as part of the HTML `<title>` tag on admin screens.

Props ravipatel, hellofromTonya, sabernhardt, audrasjb, SergeyBiryukov.
Fixes #53729.

git-svn-id: https://develop.svn.wordpress.org/trunk@51475 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 13:51:58 +00:00
Sergey Biryukov
49b11dcad7 Docs: Correct a comment about WebP constants in wp-includes/compat.php.
Follow-up to [50810], [50814].

Props GaryJ, rtm909.
Fixes #53680.

git-svn-id: https://develop.svn.wordpress.org/trunk@51474 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 13:06:55 +00:00
Sergey Biryukov
70c9aabf0d Help/About: Add / character to <img> and <source> tags.
While this has no effect on void elements in HTML5, it fixes a minor inconsistency with the rest of core.

Follow-up to [47493], [48834], [50556], [51418].

Props radixweb, ankitmaru, TobiasBg, sabernhardt, audrasjb.
Fixes #53716.

git-svn-id: https://develop.svn.wordpress.org/trunk@51473 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 12:57:48 +00:00
Greg Ziółkowski
3f83b50743 I18n: Fix broken loop in WP_Theme_JSON_Resolver
Related issue in Gutenberg: https://github.com/WordPress/gutenberg/issues/33552

The loop in WP_Theme_JSON_Resolver to extract translatable paths was broken, as it contained an immediate and unconditional return. This caused the loop to immediately exit again after the first iteration, thus never actually looping.

Follow-up to [50959].

Props schlessera.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@51472 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 10:05:33 +00:00
Greg Ziółkowski
211d94b710 Editor: Conditionally load registered styles for block variations
In WordPress 5.8 we added the ability to only load styles for blocks when these blocks are rendered. However, these optimizations left out block-styles that get added using the register_block_style() function/API.

Props aristath.
Fixes #53616.



git-svn-id: https://develop.svn.wordpress.org/trunk@51471 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-22 08:36:11 +00:00
Sergey Biryukov
92c454cec6 Build/Test Tools: Update PHP_CodeSniffer to version 3.6.0.
The latest releases contain various bugfixes, as well as (nearly complete) support for PHP 8.0.

Relevant changelogs:
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.5.6
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.5.7
* https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.6.0

For a full list of changes in this update, see the PHP_CodeSniffer GitHub:
https://github.com/squizlabs/PHP_CodeSniffer/compare/3.5.5...3.6.0

Props jrf.
Fixes #53477.

git-svn-id: https://develop.svn.wordpress.org/trunk@51470 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-21 14:30:42 +00:00
Jonathan Desrosiers
09bbc174c0 External Libraries: Correct the underscore version used when registering.
The correct version is `1.13.1`.

Follow up to [50650], [50778].

Props david.binda.
Fixes #53713.

git-svn-id: https://develop.svn.wordpress.org/trunk@51469 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-21 12:32:57 +00:00
Jonathan Desrosiers
ca214a3b4c External Libraries: Correct the jquery-form version used when registering.
The correct version is `4.3.0`.

Follow up to [50546].

Props david.binda.
Fixes #53714.

git-svn-id: https://develop.svn.wordpress.org/trunk@51468 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-21 12:19:26 +00:00
Jonathan Desrosiers
0e08acda70 External Libraries: Correct the hoverIntent version used when registering.
Follow up to [50521].

Props david.binda.
Fixes #53715.

git-svn-id: https://develop.svn.wordpress.org/trunk@51467 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-21 12:16:35 +00:00
John Blackbourn
0167d6dd50 Application Passwords: Improve various user-facing and developer-facing terminology.
Fixes #53503, #53691


git-svn-id: https://develop.svn.wordpress.org/trunk@51463 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-19 21:13:36 +00:00
Sergey Biryukov
c70fe62ed1 Tests: Replace assertContains() with assertStringContainsString() when used with strings.
Using the `assertContains()` and `assertNotContains()` methods with string haystacks was deprecated in PHPUnit 8 and removed in PHPUnit 9.

While WordPress test suite currently only supports PHPUnit up to 7.5.x, this allows us to switch to newer assertions ahead of adding full support for PHPUnit 8+.

These methods introduced in PHPUnit 7.5 should be used as an alternative:

* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods were added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51331], [51451], [51461].

Props jrf, dd32, SergeyBiryukov.
See #53363, #46149.

git-svn-id: https://develop.svn.wordpress.org/trunk@51462 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-19 14:00:11 +00:00
Sergey Biryukov
bb3bf22547 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertFalse( stripos( ... ) )` with `assertStringNotContainsString()` or `assertStringNotContainsStringIgnoringCase()` to use native PHPUnit functionality.

Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:

* `assertStringContainsString()`
* `assertStringContainsStringIgnoringCase()`
* `assertStringNotContainsString()`
* `assertStringNotContainsStringIgnoringCase()`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453], [51454].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51461 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-19 13:29:45 +00:00
Jonathan Desrosiers
fd872e56fd Upgrade/Install: Add additional files to $_old_files for 5.8.
Follow up to [51134].

Fixes #53367.

git-svn-id: https://develop.svn.wordpress.org/trunk@51459 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-19 00:58:50 +00:00
Jonathan Desrosiers
2001b2252e Build/Test Tools: Update the caniuse browser data and regenerate CSS.
This includes three minor updates to generated CSS files:

- A single `-webkit-` prefix is removed for `min-width`, which was required for Safari <= 10.1 (0.06% total global usage). WordPress only supports the last two versions.
- 2 instances where the `-o-` prefix are added for `tab-size`. This appears to be for Opera Mobile, which has creeped back over the 1% global usage.

Props peterwilsoncc, jorbin.
Fixes #53686.

git-svn-id: https://develop.svn.wordpress.org/trunk@51456 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-19 00:40:49 +00:00
Jonathan Desrosiers
d69216bf55 Bundled Themes: Bump bundled theme versions for WordPress 5.8.
This bumps the version for all bundle themes in preparation for release with WordPress 5.8. The new versions are as follows:

- Twenty Twenty-One: 1.4
- Twenty Twenty: 1.8
- Twenty Nineteen: 2.1
- Twenty Seventeen: 2.8
- Twenty Sixteen: 2.5
- Twenty Fifteen: 3.0
- Twenty Fourteen: 3.2
- Twenty Thirteen: 3.4
- Twenty Twelve: 3.4
- Twenty Eleven: 3.8
- Twenty Ten: 3.4

Props mukesh27, kapilpaul.
Fixes #53277.

git-svn-id: https://develop.svn.wordpress.org/trunk@51455 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-18 23:03:08 +00:00
Sergey Biryukov
4a533f4879 Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( ... > 0 )` with `assertGreaterThan()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51454 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-18 14:10:24 +00:00
Sergey Biryukov
ba94d9b67b Tests: Use more appropriate assertions in rest_sanitize_request_arg() tests.
This replaces instances of `assertSame( true, ... )` with `assertTrue()` to use native PHPUnit functionality.

Follow-up to [38832].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51453 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-18 14:00:35 +00:00
Sergey Biryukov
f28e3d0b88 Tests: Require the WP_REST_Test_Controller class in WP_REST_Controller tests.
This avoids a "Class not found" PHP fatal error when running these tests separately.

Follow-up to [38832].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51452 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-18 13:45:57 +00:00
Sergey Biryukov
54c54f9a1e Tests: Use more appropriate assertions in various tests.
This replaces instances of `assertTrue( strpos( ... ) > 0 )` with `assertStringContainsString()` to use native PHPUnit functionality.

Going forward, these methods introduced in PHPUnit 7.5 should be used for similar assertions:

* `assertStringContainsString()`
* `assertStringNotContainsString()`

As WordPress currently uses PHPUnit 5.7.x to run tests on PHP 5.6, polyfills for these methods are now added to the `WP_UnitTestCase` class for PHPUnit < 7.5.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51451 602fd350-edb4-49c9-b593-d223f7449a82
2021-07-17 10:36:52 +00:00