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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Manuel Garcia created an issue. See original summary.

Manuel Garcia’s picture

Here is a start.

Dane Powell’s picture

Status: Needs review » Postponed (maintainer needs more info)

We've completely revamped the test scenarios lately, is this still an issue?

Manuel Garcia’s picture

I 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?

Dane Powell’s picture

Status: Postponed (maintainer needs more info) » Active

Thanks 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.

Dane Powell’s picture

Title: PHP Error: Call to undefined method PHPUnit\Framework\Error\Warning::getResponse() » PHP Error: Call to undefined method getResponse()

Changing the title since this is unlikely to appear in tests any more, but I could see how it would still happen elsewhere.

japerry’s picture

Status: Active » Fixed

Well we aren't doing anything with the response, so no point in even grabbing it. Removed.

  • japerry committed 9ab10f3 on 8.x-1.x
    Issue #3044365 by japerry: Remove non-used response variable causing...

Status: Fixed » Closed (fixed)

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