One change in the update from Xdebug version 2.x to 3.x was a shift from enabling features to switching into modes.
When the version of Xdebug installed in the PHP 7.4 Docker container was updated from 2.x to 3.x, the code coverage reporting workflow stopped generating reports due to a lack of available coverage drivers.
This change adds the `XDEBUG_MODE` environment variable to the local Docker environment configuration to allow the active modes to be changed. This environment variable takes precedence over the `xdebug.mode` setting, but will not change the value of the `xdebug.mode` setting.
The `LOCAL_PHP_XDEBUG_MODE` environment variable has been added to the `.env` file and can be used to change the modes enabled in the Docker container. The code coverage reporting workflow uses this variable to enable the `coverage` mode, which is required for generating a test coverage report.
By default, `debug` and `debug modes are active, which enables the more commonly used features of Xdebug: development helpers and step debugging.
Props afragen, johnbillion, desrosj.
Fixes#56022.
git-svn-id: https://develop.svn.wordpress.org/trunk@53552 602fd350-edb4-49c9-b593-d223f7449a82
Cache result of database queries in `_find_post_by_old_slug` and `_find_post_by_old_date` functions. This means that repeated requests to a url where the page is not found, will result in hitting a cache for sites running persistent object caching.
Props Spacedmonkey, dd32, mukesh27, pbearne, flixos90.
Fixes#36723.
git-svn-id: https://develop.svn.wordpress.org/trunk@53549 602fd350-edb4-49c9-b593-d223f7449a82
This changeset sets the `ignore_sticky_posts` parameter to `true` in the default arguments passed to `wp_sitemaps_posts_query_args`.
Props RavanH, pbiron, swissspidy, audrasjb, SergeyBiryukov.
Fixes#55633.
git-svn-id: https://develop.svn.wordpress.org/trunk@53548 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$filesize` value being included in the returned array.
This affects:
* `wp_generate_attachment_metadata()`
* `wp_get_attachment_metadata()`
* `WP_Image_Editor::save()`
* `WP_Image_Editor_GD::save()` and `::_save()`
* `WP_Image_Editor_Imagick::save()` and `::_save()`
Follow-up to [22094], [22619], [52837], [53546].
See #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53547 602fd350-edb4-49c9-b593-d223f7449a82
Since WordPress 3.5, `wp_save_image_file()` uses `WP_Image_Editor` classes under the hood to save the images.
While the `save()` method in those instances returns `array|WP_Error` and is documented as such, the return type of the `wp_save_image_file()` function was still left as `bool`.
A better solution would be to adjust the function to return the documented boolean type. However, doing that after 20+ major WP releases would be a backward compatibility break, so the documentation is now updated instead.
Includes:
* Documenting the returned array using hash notation.
* Adding a `@since` note for the `$image` parameter expecting a `WP_Image_Editor` instance.
* Adding a `@since` note for the `$filesize` value being included in the returned array.
Follow-up to [22094], [22619], [52837].
Props jrf, SergeyBiryukov.
See #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53546 602fd350-edb4-49c9-b593-d223f7449a82
Move logic to generate link to global styles to the `prepare_links` method in theme REST API controller. This way all logic to generate links is within the `prepare_links` method, bringing this controller inline with other REST API controllers.
Props SergeyBiryukov, Spacedmonkey.
Fixes#56018.
git-svn-id: https://develop.svn.wordpress.org/trunk@53544 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Making the test method names more specific.
* Converting one-off helper methods to static closures.
* Adding a failure message to each assertion when multiple assertions are used in the test.
Follow-up to [1126/tests], [1201/tests], [53292], [53495], [53522], [53538].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53541 602fd350-edb4-49c9-b593-d223f7449a82
This changeset removes Meetup as an oEmbed source, since Meetup.com have deprecated their oEmbed endpoint. The block has already been removed from the editor, see GB#35085.
Props peterwilsoncc, audrasjb, swissspidy.
Fixes#55997.
git-svn-id: https://develop.svn.wordpress.org/trunk@53540 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
Follow-up to [1126/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531], [53537].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53538 602fd350-edb4-49c9-b593-d223f7449a82
This one test was testing three different situations. When one assertion fails, the rest of the test would not be executed, so this leads to hiding one error behind another.
Splitting the test into three distinct test methods still allows for testing each situation, but tests each one in isolation and won't hide errors.
The third part of the test, dealing with image editor engine classes, will also now use a data provider.
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding `@covers` annotations.
* Adding a failure message to each assertion when multiple assertions are used in the test.
* Reusing an existing data provider with the available image editor engine classes.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530], [53531].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53537 602fd350-edb4-49c9-b593-d223f7449a82
Previously, in case of failure, `WP_UnitTestCase_Base::assertNotWPError()` displayed the actual error message from the passed `WP_Error` object, but only if the `$message` parameter was empty.
This made the assertion less helpful, as the actual error message was lost in case there was a non-empty `$message` parameter passed to the method, as per the [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#using-assertions Writing PHP Tests] guidelines:
> All PHPUnit assertions, as well as all WordPress custom assertions, allow for a `$message` parameter to be passed. This message will be displayed when the assertion fails and can help immensely when debugging a test. This parameter should always be used if more than one assertion is used in a test method.
This commit ensures that the actual error message is always displayed, in addition to the passed `$message` parameter.
The same applies to `WP_UnitTestCase_Base::assertNotIXRError()`.
Follow-up to [34638], [40417].
Props jrf, SergeyBiryukov.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53536 602fd350-edb4-49c9-b593-d223f7449a82
This adjusts the logic used to determine the outcome of the previous workflow run of the current one to account for `schedule` and `workflow_dispatch` events.
In the current state, only workflows triggered by `push` events are examined. This is causing failures when trying to post Slack notifications for the Test Coverage workflow, and inconsistent results for `workflow_dispatch` events when testing older branches on a schedule.
Follow up to [53466] and [53468].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53534 602fd350-edb4-49c9-b593-d223f7449a82
Don't unnecessarily load the image twice in `test_inferred_mime_types_when_saving_an_image()`.
Follow-up to [1061/tests], [1151/tests], [1157/tests], [29834].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53532 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Adding a skip annotation for unsupported mime types.
* Making the test method name more specific.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529], [53530].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53531 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a failure message to each assertion.
* Making the test method name more specific.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526], [53529].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53530 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. The output from PHPUnit will be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
* Adding a skip annotation for unsupported mime types.
* Adding a failure message to each assertion.
Follow-up to [1061/tests], [53495], [53497], [53521], [53523], [53524], [53525], [53526].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53529 602fd350-edb4-49c9-b593-d223f7449a82
This moves the test for valid types first, to match `file_is_valid_image()` and `file_is_displayable_image()` tests.
Follow-up to [48798], [53527].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53528 602fd350-edb4-49c9-b593-d223f7449a82
This matches the names of the functions being tested:
* `file_is_valid_image()`
* `file_is_displayable_image()`
Follow-up to [184/tests], [53523], [53524], [53525], [53526].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53527 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
Follow-up to [184/tests], [53495], [53497], [53521], [53523], [53524], [53525].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53526 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.
Follow-up to [184/tests], [42780], [53495], [53497], [53521], [53523], [53524].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53525 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Adding a `@covers` annotation.
Follow-up to [184/tests], [53495], [53497], [53521], [53523].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53524 602fd350-edb4-49c9-b593-d223f7449a82
Using a data provider has a number of advantages:
1. If the first test case fails, it won't prevent the other test cases from being tested.
2. While the assertion used in this test method ''does'' have a "failure message" (👍), the output from PHPUnit itself will already be more descriptive in case of failure when using a data provider.
3. Using named test cases in the data provider will also make the `--testdox` output much more descriptive and informative.
The actual cases being tested, or the test itself have not been changed.
Includes:
* Changing the conditional addition of the `.ico` file type to be unconditional, it was only needed for PHP < 5.3.
* Adding a `@covers` annotation.
Follow-up to [184/tests], [42780], [53495], [53497], [53521].
Props jrf.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53523 602fd350-edb4-49c9-b593-d223f7449a82
This introduces a new test helper function which allows for turning a single-level array containing text strings into a data provider with named data sets, where the value of the data set will also be used as the name of the data set.
The function contains safeguards to ensure that it is only used with data compatible with this principle and will throw generic PHP exceptions when the data is incompatible. These type of exceptions will be displayed before the tests even start running and will stop the test run when they occur.
While generally speaking, all test cases ''should'' extend the base `WP_UnitTestCase_Base` class, this is still made a `public static` method to allow for a test, which by exception directly extends the PHPUnit base `TestCase` or the `PHPUnit_Adapter_TestCase`, to also be able to use this method.
Typical usage of this method:
{{{
public function data_provider_for_test_name() {
$array = array(
'value1',
'value2',
);
return $this->text_array_to_dataprovider( $array );
}
}}}
The returned result will look like:
{{{
array(
'value1' => array( 'value1' ),
'value2' => array( 'value2' ),
)
}}}
Props jrf, hellofromTonya, adamsilverstein.
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53521 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that the global is explicitly declared and documented in:
* `get_next_posts_link()`
* `get_posts_nav_link()`
* `get_the_posts_navigation()`
* `get_the_posts_pagination()`
* `get_next_comments_link()`
Follow-up to [30065].
Props mt8.biz, sabernhardt.
Fixes#43164.
git-svn-id: https://develop.svn.wordpress.org/trunk@53520 602fd350-edb4-49c9-b593-d223f7449a82
This brings more consistency with similar `require_once` statements and `_deprecated_file()` calls in other files.
Follow-up to [601], [628], [36693], [44359], [45663], [45678], [52026],
Props malthert.
See #54233.
git-svn-id: https://develop.svn.wordpress.org/trunk@53518 602fd350-edb4-49c9-b593-d223f7449a82
This changes removes an hardcoded CSS color value for the Quote block in Twenty Twenty-One's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.
Props jyolsna, evildon, kajalgohel, audrasjb.
Fixes#55989.
git-svn-id: https://develop.svn.wordpress.org/trunk@53517 602fd350-edb4-49c9-b593-d223f7449a82
This changes removes an hardcoded CSS color value for the Quote block in Twenty Nineteen's editor stylesheet. This ensures custom text color is fully reflected in the Editor for Quote block.
Props nithi22, evildon, SergeyBiryukov, audrasjb.
Fixes#55992.
git-svn-id: https://develop.svn.wordpress.org/trunk@53515 602fd350-edb4-49c9-b593-d223f7449a82
* As of WordPress 3.6.1, the `html5` feature requires an array of types to be passed. Defaults to `comment-list`, `comment-form`, `search-form` for backward compatibility.
* As of WordPress 6.0, the previously added `_doing_it_wrong()` notice is actually displayed as expected.
Follow-up to [25193], [25235], [25785], [49344], [49354], [52828].
Props bobbingwide.
See #51657, #55646.
git-svn-id: https://develop.svn.wordpress.org/trunk@53513 602fd350-edb4-49c9-b593-d223f7449a82
Ensure that that attachment objects are not primed in cache so that test passes when object caching is enabled.
Follow-up to [53506].
Props SergeyBiryukov.
See #55593.
git-svn-id: https://develop.svn.wordpress.org/trunk@53512 602fd350-edb4-49c9-b593-d223f7449a82
This needs more investigation to address the test failure with persistent object cache.
Follow-up to [53506].
Props hellofromTonya.
See #55593.
git-svn-id: https://develop.svn.wordpress.org/trunk@53511 602fd350-edb4-49c9-b593-d223f7449a82
This ensures that not only the array values being compared are equal, but also that their type is the same.
Going forward, stricter type checking by using `assertSameSets()` or `assertSameSetsWithIndex()` should generally be preferred, to make the tests more reliable.
Follow-up to [48939], [51137], [51943], [53499], [53504], [53506], [53509].
See #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53510 602fd350-edb4-49c9-b593-d223f7449a82
* Give the test methods more specific names and move them closer together.
* Correct the `@covers` tags.
Follow-up to [53499], [53504], [53506], [53507], [53508].
See #55593, #55652.
git-svn-id: https://develop.svn.wordpress.org/trunk@53509 602fd350-edb4-49c9-b593-d223f7449a82
* Make the function description more specific, for consistency with other similar functions.
* Add a `@since` note for the `$update_menu_item_cache` parameter of `WP_Query::parse_query()`.
* Add missing `@covers` tags for the unit tests.
Follow-up to [53504].
See #55620.
git-svn-id: https://develop.svn.wordpress.org/trunk@53508 602fd350-edb4-49c9-b593-d223f7449a82
* Make the function description more specific, for consistency with `update_post_author_caches()`.
* Add missing `@covers` tags for the unit test.
Follow-up to [53506].
See #55593.
git-svn-id: https://develop.svn.wordpress.org/trunk@53507 602fd350-edb4-49c9-b593-d223f7449a82
Prime caches for all post parents in the post REST API controller using the `_prime_post_caches` function. Post parent objects are required as part of the `check_read_permission` method’s permission check in post REST API controller.
Props spacedmonkey, furi3r, peterwilsoncc, mitogh, madpixels.
Fixes#55593.
git-svn-id: https://develop.svn.wordpress.org/trunk@53506 602fd350-edb4-49c9-b593-d223f7449a82
When using multilingual websites, this string could end up with multiple different translations in the error log, making it less actionable.
Unlike errors displayed to the user, a general consensus for software is that errors in logs should always be in English. Since MySQL errors are also returned in English, this brings more consistency to the logs.
Follow-up to [6391], [8168], [19760].
Props malthert.
Fixes#53125.
git-svn-id: https://develop.svn.wordpress.org/trunk@53505 602fd350-edb4-49c9-b593-d223f7449a82
Add a new parameter to `WP_Query` called `update_menu_item_cache` that when set to true, primes the caches for linked terms and posts for menu item post objects. This change moves logic
found in `wp_get_nav_menu_items` into a new function called `update_menu_item_cache`. Update the menu item REST API controller, to pass the `update_menu_item_cache` parameter to the
arguments used for the `WP_Query` run to get menu items.
Props furi3r, TimothyBlynJacobs, spacedmonkey, peterwilsoncc, mitogh.
Fixes#55620.
--This line, and those below, will be ignored--
M src/wp-includes/class-wp-query.php
M src/wp-includes/nav-menu.php
M src/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php
M tests/phpunit/tests/post/nav-menu.php
git-svn-id: https://develop.svn.wordpress.org/trunk@53504 602fd350-edb4-49c9-b593-d223f7449a82