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.
When running tests, I'm getting this PHP error:
PHPUnit\Framework\Exception: PHP Error: Call to undefined method PHPUnit\Framework\Error\Warning::getResponse() in modules/contrib/acquia_connector/src/Controller/SecurityReviewController.php on line 387
The line is this one:
catch (\Exception $e) {
$response = $e->getResponse();
}
Using module version 8.x-1.16
Comment | File | Size | Author |
---|---|---|---|
#2 | 3044365-2.patch | 492 bytes | Manuel Garcia |
Comments
Comment #2
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedHere is a start.
Comment #3
Dane Powell CreditAttribution: Dane Powell at Acquia commentedWe've completely revamped the test scenarios lately, is this still an issue?
Comment #4
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedI haven’t checked lately but I believe that line to be incorrect independent of the tests, the exception will never have a
getResponse()
method as far as I know...Should we be catching
RequestException
instead?Comment #5
Dane Powell CreditAttribution: Dane Powell at Acquia commentedThanks for following up, I see what you mean now. We need to catch a more specific exception (RequestException) to ensure that method exists, and then actually do something with the response.
Comment #6
Dane Powell CreditAttribution: Dane Powell at Acquia commentedChanging the title since this is unlikely to appear in tests any more, but I could see how it would still happen elsewhere.
Comment #7
japerryWell we aren't doing anything with the response, so no point in even grabbing it. Removed.