Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 301709

Add return typehints to setUp/tearDown methods in concrete test classes

$
0
0

Problem/Motivation

Spin-off from #3063887: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7.

PHPUnit 8 is changing the signature of the main test methods that test classes extend - above all setUp and tearDown, adding a void return typehint.

As per #3063887-75: Support PHPUnit 8 in Drupal 9, drop support for PHPUnit 7, in this issue we change the signatures of the methods in concrete Drupal test code according to PHPUnit 8.

Proposed resolution

Change all the implementations of

  • setUp()
  • tearDown()
  • setUpBeforeClass()
  • assertPostConditions()

in concrete test classes to have a void return typehint.

We will then add a deprecation to inform developers of this change in #3111044: Deprecate setUp/tearDown concrete test methods that do not specify void return type

We cannot change abstract base test classes without breaking backward compatibility, so that will be done in a follow-up.

Remaining tasks

Patch.

User interface changes

API changes

Data model changes

Release notes snippet

Overridden test methods should have void return type hints added, see the change record at https://www.drupal.org/node/3114724 for more details.


Viewing all articles
Browse latest Browse all 301709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>