- Issue created by @joachim
I'm trying to fix 🐛 CI broken Active , and one test is failing here:
try {
$access_token = $plugin->initializeToken($remote, $credentials);
}
catch (\Exception $e) {
$this->fail('The access token had not been generated.');
}
Catching an exception just to fail a test looks like a code smell to me -- phpunit fails on an exception anyway, and you get the exception message and backtrace too, rather than it being obscured as it is here.
Except when I remove the try/catch from this call, the test passes!???
I've experimented with putting a line ' throw new \Exception('FAIL');' in various places in the test, and narrowed it down to here in EntityShareClientFunctionalTestBase::setUp():
$this->createRemote($this->channelUser);
throw new \Exception('FAIL');
This exception does not cause the test to fail!
The problem is that EntityShareClientFunctionalTestBase::setUp() calls createAuthenticationPlugin(), which the test class overrides, and has a try/catch block there.
Active
4.0
Code