From 211e1f115617c93caa97ff7d29a1434ebfda9ca1 Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Fri, 24 Sep 2021 13:20:01 +0000 Subject: [PATCH] Build/Test Tools: Fix test forward-compatibility layer. In [51838], 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 [51838]. Props bjorsch, swisspidy, jrf, hellofromTonya. See #53911. Built from https://develop.svn.wordpress.org/branches/5.8@51861 git-svn-id: http://core.svn.wordpress.org/branches/5.8@51460 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 03468224b7..03845551e2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8.2-alpha-51838'; +$wp_version = '5.8.2-alpha-51861'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.