mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Dont use willReturn assertions to assert argument types
This commit is contained in:
parent
7d15d0af70
commit
15bf13daa9
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user