Problem/Motivation
DrupalStandardsListenerTrait has been broken since issue #3186443: PHPUnit 9.5 Call to undefined method ::getAnnotations().
1) the test class passed in for finding the annotations is the listener's itself, not the test one
2) the test method passed in the the test name, which in case of tests with dataproviders includes the dataset name
Proposed ultimate resolution as conceived by @mondrake
Actually, remove DrupalStandardsListenerTrait altogether - phpstan/phpstan-phpunit is better at doing these checks, and helped find out this issue. Therefore, complete #3326239: Add phpstan/phpstan-phpunit as a dev dependency, and once done that, remove DrupalStandardsListenerTrait. That would also help in future efforts to migrate to PHPUnit 10 that drops the usage of listeners.
Proposed resolution for this issue
- Fix DrupalStandardsListenerTrait
- Fix new errors that were not discovered due to DrupalStandardsListenerTrait being broken
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3335406-2-test-only.patch | 812 bytes | mondrake |
Issue fork drupal-3335406
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mondrakeA test-only patch to prove the problem.
Comment #3
mondrakeComment #4
SpokjeNice sleuthing there @mondrake!
Seeing that the general consensus amongst release managers in #3326239: Add phpstan/phpstan-phpunit as a dev dependency seems to be that we need to split that issue up, maybe we can:
1) Fix
DrupalStandardsListenerTrait
and its currently not detected errors in here. That would make #3326239: Add phpstan/phpstan-phpunit as a dev dependency a lot smaller.2) After 1) is committed, we update the MR in #3326239: Add phpstan/phpstan-phpunit as a dev dependency.
3) After 2) is committed, we start on a new issue for removing
DrupalStandardsListenerTrait
.To me it seems that this way everybody is happy/happier.
It does mean a bit more admin overhead because there are more issues, but it seems to be the quickest way to get things done?
Comment #5
SpokjeComment #6
SpokjeComment #8
mondrakeThe @covers in the [driver]DriverLegacyTest classes
should just be removed IMHO - they trigger deprecations at the class autoloading time that phpunit-bridge cannot capture, and in any case those are just stub classes, there's no purpose in
@cover
ing them. Doing that you can leave the stubbed classes alone.Comment #9
mondrakeI can already see people complaining if we remove the docblock. Maybe change to
Comment #10
SpokjeThanks @mondrake, I was trying to find out what triggered the (newly found) deprecations.
Might have eventually ended up with the
@covers
triggering them, but you were way ahead of me :)Did however arrived at not-deleting-the-docblock-completely around the same time as you.
Comment #11
mondrakeFor the database specific schema test issues, I think it should suffice adding the abstract class Drupal\Core\Database\Schema to the @covers of the abstract class DriverSpecificSchemaTestBase, like
and only in case of the test method being overridden at the specific database concrete test class, then specify a @covers for the driver's schema class.
No idea about why the listener test itself throw a deprecation, tho...
Comment #12
mondrake... exactly what you did ... :)
Comment #13
SpokjeI have my moments ;)
Comment #14
SpokjeComment #15
mondrakeThanks!
Comment #16
xjmThis mostly looks good to me and (unlike #3326239: Add phpstan/phpstan-phpunit as a dev dependency) is mostly only fixing fails that can be evaluated within the context of the diff.
I reviewed the MR and left a few questions, a nitpick, and a request for at least an inline comment if not tests for the bugfix.
Tagging "Needs followup" for the place where the test method names are a lie.
Comment #17
mondrakeAdded comments on the MR.
Comment #18
mondrakeFiled #3350400: Remove DrupalStandardsListenerTrait - it's broken, does not prevent errors, blocks better tooling for an alternative approach.
Comment #19
alexpottOver in #3350400: Remove DrupalStandardsListenerTrait - it's broken, does not prevent errors, blocks better tooling we decided to not fix this but remove it. So now onto #3326239: Add phpstan/phpstan-phpunit as a dev dependency as the better fix.