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