Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
TestBase::run()
contains some unnecessary layers of control structure nesting, which make it hard to change the execution flow.
Attached patch performs no functional changes, and only removes the nesting:
- The test class requirements check is moved first.
- Test methods are immediately filtered upon retrieval, instead of within the foreach loop.
Comment | File | Size | Author |
---|---|---|---|
#2 | drupal8.test-run.2.patch | 7.26 KB | sun |
drupal8.test-run.0.patch | 7.03 KB | sun | |
Comments
Comment #2
sunD'oh! :)
Comment #3
BerdirI know this is just moved but it really makes no sense :)
Not something to worry about here, but do we really to support something like that? It's not documented or used anywhere.
It's not that visible in the patch, but if you apply it, the code in run() is much less nested and easier to follow. Looks good to me.
Comment #4
sunYeah, I also wondered about that SORT_METHODS class constant thingie — I didn't know that this existed, and I do not really understand how that makes any sense.
Created #2202377: Remove Test::SORT_METHODS constant opt-in support for sorting test methods alphabetically
Comment #5
sun2: drupal8.test-run.2.patch queued for re-testing.
Comment #6
sun2: drupal8.test-run.2.patch queued for re-testing.
Comment #7
sunTwo issues are blocked on this:
#2206417: Bogus tests without test methods are reported as successful tests
#1411074: Add a flag to set up test environment only once per test class; introduce setUpBeforeClass() and tearDownAfterClass() [PHPUnit]
Eagerly waiting for this commit.
Comment #8
Dries CreditAttribution: Dries commentedLooks good to me. Committed to 8.x. Thanks!