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.
Problem/Motivation
PHP Fatal error: Call to a member function getCollectCodeCoverageInformation() on a non-object in /var/lib/drupaltestbot/sites/default/files/checkout/core/tests/Drupal/Tests/Standards/DrupalStandardsListener.php on line 58
PHP Warning: Invalid argument supplied for foreach() in /var/lib/drupaltestbot/sites/default/files/checkout/core/scripts/run-tests.sh on line 585
Warning: Invalid argument supplied for foreach() in /var/lib/drupaltestbot/sites/default/files/checkout/core/scripts/run-tests.sh on line 585
This happens when Payment 8.x-2.x. PHPUnit does not document that test results do not always have to exist, so based on the documentation the current code is correct, but in practice it causes errors.
Proposed resolution
Check for the existence of the results.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#1 | drupal_2443885_1.patch | 772 bytes | Xano |
Comments
Comment #1
XanoComment #2
dawehner@xano
Just curious, is that for stuff like skipped tests or is this really for a test class without any test method?
Comment #3
XanoI cannot reproduce the failure locally, neither by running unit tests through PHPUnit directly or through run-tests.sh, so I can't really debug. The listener class is to make sure all
@covers
annotations are correct, but that's something that PHPUnit has been doing itself on my local machines for years now.Comment #4
dawehner@Xaxo
Can you point to the test code which fails?
Comment #5
XanoThe Payment 8.x-2.x branch test results are the only source of information I have, unfortunately. I tried to reproduce this locally to pinpoint the exact cause of the problem, but whatever I do, It Just Works™.
Comment #6
ArlaI had the very same problem and opened #2442125: Unclear error message for non-test class in Unit namespace As stated there, I could reproduce locally with
run-tests.sh --class 'Drupal\Tests\mymodule\Unit\ClassWithoutTests'
.Comment #7
XanoI have a number of base test classes, one of which wasn't marked abstract, which means it was executed. The reason this went wrong on the testbot only is probably that that's the only situation in which the listener is used.
Comment #8
YesCT CreditAttribution: YesCT commentedComment #9
YesCT CreditAttribution: YesCT commentedupdating title. hopefully will help others find the answer when they have a similar problem.
Comment #10
daffie CreditAttribution: daffie commentedLooks good to me.
I can confirm that a locally run test-class with no tests results in the error.
The problem is fixed with the patch. So it is RTBC for me.
Comment #11
alexpottTest code is not frozen in beta.
Comment could do with an update...
Comment #12
alexpottI'm wrong. Thanks @neclimdul for point out :)
Comment #13
alexpottTest code is not frozen in beta. Committed 1cff097 and pushed to 8.0.x. Thanks!