Problem/Motivation

Working on #3031379: Add a new test type to do real update testing I came across this.

If your test has no test methods, then DeprecationListenerTrait::registerErrorHandler() can't reflect on the results object to add another listener (because there is not a results object). This means your test result is always THE ERROR HANDLER HAS CHANGED!

This is obviously mitigated by the fact that you should have test methods in your test class, but we can add some DX happiness through defensive coding.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 3052625_3.patch1.47 KBMile23
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Mile23 created an issue. See original summary.

Mile23’s picture

Issue summary: View changes
Mile23’s picture

Status: Active » Needs review
FileSize
1.47 KB
Mile23’s picture

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

Fair enough. I manually tested this by removing all the tests from a unit test and saw it error as described in the issue summary. With the patch attached you still get the THE ERROR HANDLER HAS CHANGED! notice but you don't get a stack trace so this looks good to go. There's not much we can do about the notice and it's not important anyway because there are no tests which is an error anyways.

Mile23’s picture

Yah the use case for this is when you change test method names to te_stSomething() for debugging, and then you get the handler changed error. :-)

  • Gábor Hojtsy committed 50a5f02 on 8.8.x
    Issue #3052625 by Mile23, alexpott: DeprecationListenerTrait croaks on...

  • Gábor Hojtsy committed 37e405c on 8.7.x
    Issue #3052625 by Mile23, alexpott: DeprecationListenerTrait croaks on...
Gábor Hojtsy’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks, committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.