moodlehq / moodle-cs

Moodle Coding Style
https://github.com/moodlehq/moodle-cs
GNU General Public License v3.0
18 stars 16 forks source link

Detect that setUpBeforeClass, setUp, tearDown, and tearDownAfterClass are always calling to parent #106

Closed stronk7 closed 5 months ago

stronk7 commented 9 months ago

While it's not critical right now, we'll need to ensure that all the chain of parents are always executed, else, we may be missing cleaning stuff.

More important, with PHPUnit 10 we MUST (are forced) to move big chunks of stuff from current runBare() method (that has been declared final, hence we cannot overwrite it anymore) to those methods. So better we go checking that all them are properly chained ASAP.

Note (copied from another project): for setup ones, the call normally goes at the beginning, and for tear down ones, it normally goes at the end, but having it anywhere is better than not having at all.

Ciao :-)

stronk7 commented 9 months ago

Some links that may help:

Note that there are also some new attributes that may, somehow, replace the need to chain:

https://docs.phpunit.de/en/10.5/attributes.html#template-methods

But it's not clear for me if adding them is anything better than observing the chain.

Ciao :-)

stronk7 commented 6 months ago

Link to the issue in the Tracker that will fix all current cases in core: MDL-81523