Skip to content

Removed @throws tags from IntegrationTestTrait http methods#14549

Merged
markstory merged 1 commit intomasterfrom
integration-throws
May 6, 2020
Merged

Removed @throws tags from IntegrationTestTrait http methods#14549
markstory merged 1 commit intomasterfrom
integration-throws

Conversation

@othercorey
Copy link
Copy Markdown
Contributor

Alternative to #14193

*
* @param string|array $url The URL to request.
* @return void
* @throws \PHPUnit\Framework\Error\Error|\Throwable
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is not really correct, see my intial Comments on the original pr.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as you disableErrorHandlerMiddleware() you can actually expect the \Throwable at least.

} catch (DatabaseException $e) {
throw $e;
} catch (LogicException $e) {
} catch (PhpUnitError | DatabaseException | LogicException $e) {
Copy link
Copy Markdown
Member

@garas garas May 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPUnit\Framework\Error\Error as PhpUnitError only catches PHP errors/warning/notices.

\PHPUnit\Framework\Exception class or \PHPUnit\Exception interface would be better as it would catch re-throw all PHPUnit asserts too.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great approach! Well done.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to catch phpunit assertion errors here though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to say "it should re-throw all PHPUnit asserts".

Currently they are catched in \Throwable block and rendered by ExceptionRenderer.

@othercorey
Copy link
Copy Markdown
Contributor Author

So, do we need to revert this?

ADmad added a commit that referenced this pull request May 6, 2020
Ensure app's error handler is not invoked for PHPUnit errors.

Refs #14549
ADmad added a commit that referenced this pull request May 6, 2020
Ensure app's error handler is not invoked for PHPUnit errors.

Refs #14549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants