-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Email SMTP may throw Uncaught ErrorException #6184
fix: Email SMTP may throw Uncaught ErrorException #6184
Conversation
@samsonasik The following refactoring breaks test code.
1) tests/system/Email/EmailTest.php:138
---------- begin diff ----------
@@ @@
public function testDestructDoesNotThrowException()
{
- $email = $this->getMockBuilder(Email::class)
- ->disableOriginalConstructor()
- ->onlyMethods(['sendCommand'])
- ->getMock();
+ $email = $this->createMock(Email::class);
$email->method('sendCommand')
- ->will($this->throwException(new ErrorException('SMTP Error.')));
+ ->willThrowException(new ErrorException('SMTP Error.'));
// Force resource to be injected into the property
$SMTPConnect = fopen(__FILE__, 'rb');
----------- end diff -----------
Applied rules:
* GetMockBuilderGetMockToCreateMockRector
* UseSpecificWillMethodRector |
@kenjis could you create issue/failing test case on rector-phpunit repo? Should be bug on |
47643f9
to
c4022bb
Compare
@samsonasik Created: rectorphp/rector-phpunit#86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good pending the Rector PR.
We can use |
|
In PHPUnit 10, |
@paulbalandan We and rector cannot use |
b2c0e22
to
b872d7b
Compare
Rebased. |
I appreciate all the conversation and effort to figure out these complicated tests. I also want to acknowledge that Email should be deprecated in 4.3 and is already a bit of a shabby class. If we need to hack the class or skip testing altogether I'm fine with it. |
Description
Fixes #3390
Checklist: