Tonya Mork a92437e394 Build/Test Tools: Fix test forward-compatibility layer.
In [51844], the test wrapper methods were not being called due to the names not being recognized as supported PHPUnit "hook" names for fixtures.

This commit:
- Fixes the problem by adding extra camelCase wrappers to the `WP_UnitTestCase` to call the methods in the right order.
- Adds wrappers for the `assertPreConditions()` and `assertPostConditions()` fixture methods to make the backport feature complete for the fixture wrappers.

Test wrapper methods call fix:

By adding method overloads for the PHPUnit native camelCase fixture methods and letting those call the (camelCase) parent method first and only calling the snake_case fixture methods after, the snake_case methods can be supported and the typical run order safeguarded.

As not all test classes will have declared snake_case fixture methods, the snake_case fixture methods are also declared in the `WP_UnitTestCase`. Why? This prevents having to wrap these method calls in `method_exists()` conditions checking for the existence of the snake_case methods in an unknown Test child class. And with the normal inheritance rules in combination with calling the method using `static`, the right method will be called anyway without fatal "calling undeclared method" errors.

Note: While it will be rare, there ''may'' be cases where a test class does not adhere to the normal execution order for fixtures, i.e. for the setup methods, parent first, own code second; and for the teardown methods, own code first, parent second. For example a test class which has "some code - `parent::setUp()` call - some more code" in their `setUp()` method. In those (rare) cases, the execution order of the code will now be changed, which may have side-effects. This rare case will be identified in the dev note.

Follow-up to [51844].

Props bjorsch, swissspidy, jrf, hellofromTonya.
See #53911.

git-svn-id: https://develop.svn.wordpress.org/branches/5.4@51865 602fd350-edb4-49c9-b593-d223f7449a82
2021-09-24 14:20:53 +00:00
2021-09-08 21:33:38 +00:00
2021-09-08 21:18:49 +00:00
2020-02-24 21:20:49 +00:00
2021-09-08 21:33:38 +00:00
2021-09-08 21:33:38 +00:00
2019-11-20 08:31:32 +00:00

WordPress

Build Status

Welcome to the WordPress development repository! Please check out our contributor handbook for information about how to open bug reports, contribute patches, test, documentation, or get involved in any way you can.

Getting Started

WordPress is a PHP/MySQL-based project. We have a basic development environment that you can quickly get up and running with a few commands. First off, you will need to download and install Docker, if you don't have it already. After that, there are a few commands to run:

Development Environment Commands

Running these commands will start the development environment:

npm install
npm run build:dev
npm run env:start
npm run env:install

Additionally, npm run env:stop will stop the environment.

npm run env:cli runs the WP-CLI tool. WP-CLI has a lot of useful commands you can use to work on your WordPress site. Where the documentation mentions running wp, run npm run env:cli instead. For example, npm run env:cli help.

npm run test:php and npm run test:e2e run the PHP and E2E test suites, respectively.

Description
No description provided
Readme 244 MiB
Languages
PHP 81.4%
CSS 8.9%
JavaScript 8.2%
SCSS 0.8%
HTML 0.7%