Dont use willReturn assertions to assert argument types

This commit is contained in:
Dan Hensby 2018-09-26 00:21:37 +01:00
parent 7d15d0af70
commit 15bf13daa9
No known key found for this signature in database
GPG Key ID: 3906B235643EF10B

View File

@ -28,9 +28,9 @@ class SwiftMailerTest extends SapphireTest
$transport
->expects($this->once())
->method('registerPlugin')
->willReturnCallback(function ($plugin) {
$this->assertInstanceOf(Swift_Plugins_AntiFloodPlugin::class, $plugin);
});
->with(
$this->isInstanceOf(Swift_Plugins_AntiFloodPlugin::class)
);
/** @var Swift_Mailer $swift */
$swift = $this->getMockBuilder(Swift_Mailer::class)->disableOriginalConstructor()->getMock();
@ -54,9 +54,9 @@ class SwiftMailerTest extends SapphireTest
$mailer = $this->getMockBuilder(SwiftMailer::class)
->setMethods(array('sendSwift'))
->getMock();
$mailer->expects($this->once())->method('sendSwift')->willReturnCallback(function ($message) {
$this->assertInstanceOf(Swift_Message::class, $message);
});
$mailer->expects($this->once())->method('sendSwift')->with(
$this->isInstanceOf(Swift_Message::class)
);
$mailer->send($email);
}