Problem/Motivation
This issue came out in #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration.
As we are deprecating functions/methods we are starting to emit deprecation errors @trigger_error('...', E_USER_DEPRECATED). Right now there's now way to test such errors and, in general, all kind of errors that are not exceptions.
Proposed resolution
Provide a trait with two methods to be used with unit, kernel and browser/javascript tests:
trait ErrorTestTrait {
protected function assertError($message, $severity) {...}
protected function assertNoError($message, $severity) {...}
}
Remaining tasks
Discuss. Agree. Implement.
User interface changes
None.
API changes
New trait ^^^.
Data model changes
None.
Comments
Comment #2
claudiu.cristeaComment #3
dawehnerThis sounds like a duplicate of #2488860: Bring phpunit bridge into drupal and use it for unit tests and simpletest to handle Deprecation for me at this point in time.
Comment #4
dawehnerOh wait, maybe I'm confused. Can't you test assertions already as phpunit will convert it to an exception?
Comment #5
alexpottYes I'm pretty sure #2488860: Bring phpunit bridge into drupal and use it for unit tests and simpletest to handle Deprecation is the way we want to test
@trigger_error('...', E_USER_DEPRECATED). In fact I'll really like to get that done rather than adding odd tests.Comment #6
claudiu.cristea@dawehner, does PHPUnit convert errors into exceptions? Hm, I didn't know this.
Comment #7
claudiu.cristeaI see. I missed the other issue.
Comment #8
claudiu.cristeaClosing as duplicate of #2488860: Bring phpunit bridge into drupal and use it for unit tests and simpletest to handle Deprecation.