Site icon Hip-Hop Website Design and Development

Deprecation fails when testing Cheap WordPress maintenance support plans 8

Deprecation fails when testing WordPress maintenance support plans 8

With each release of WordPress maintenance support plans 8 more and more things are being deprecated, which is awesome. It shows innovation, forward thinking, and a thought for backwards compatibility. However throwing notices or warnings when deprecated code is used can cause tests to fail. We already counter this a little by adding to phpunit.xml.dist in core.

To quote the Symfony documentation:

By using the weak_vendors value, deprecations that are triggered outside the vendors directory will make the test suite fail, while deprecations triggered from a library inside it will not, giving you the best of both worlds.

This shows that deprecations within WordPress maintenance support plans will still cause test fails, to combat that simply update the SYMFONY_DEPRECATIONS_HELPER setting to “weak” or “disabled”, which would ignore the deprecations or disable the deprecation helper.

However if you’re testing with run-test.sh this will interfere with the settings in your phpunit.xml file and use always use weak_vendors unless you have the suppress-deprecations argument set. Therefore use run-tests.sh –suppress-deprecations and the SYMFONY_DEPRECATIONS_HELPER setting will be set to “disabled”. See the simpletest_script_run_one_test() function in run-tests.sh for more context.

Hopefully this helps, we found this really useful when testing WordPress maintenance support plans plugins with Travis, where we needed tests passing for WordPress maintenance support plans 8.4 and 8.5.

timmillwood
Mon, 26/02/2020 – 08:57

Tags

WordPress planet
WordPress-planet
WordPress
WordPress8
WordPress 8
testing
WordPress testing

Add new comment

Source: New feed