diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-25 22:21:27 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-03-25 22:21:27 +0100 |
commit | 2ee65f177e4f7e09ad2287f14d564e7068d322fb (patch) | |
tree | 39075e87ea7927e20e8956824cb7c49bf626b178 /tests/lib/Mail | |
parent | 3cf321fdfc4235a87015a9af2f59c63220016c65 (diff) | |
download | nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.tar.gz nextcloud-server-2ee65f177e4f7e09ad2287f14d564e7068d322fb.zip |
Use the shorter phpunit syntax for mocked return values
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Mail')
-rw-r--r-- | tests/lib/Mail/MailerTest.php | 24 | ||||
-rw-r--r-- | tests/lib/Mail/MessageTest.php | 12 |
2 files changed, 18 insertions, 18 deletions
diff --git a/tests/lib/Mail/MailerTest.php b/tests/lib/Mail/MailerTest.php index 1d19929fe00..bc451f833f2 100644 --- a/tests/lib/Mail/MailerTest.php +++ b/tests/lib/Mail/MailerTest.php @@ -81,10 +81,10 @@ class MailerTest extends TestCase { $this->config ->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'sendmail'], ['mail_sendmailmode', 'smtp', $sendmailMode], - ])); + ]); $path = \OC_Helper::findBinaryPath('sendmail'); if ($path === null) { @@ -104,10 +104,10 @@ class MailerTest extends TestCase { $this->config ->expects($this->exactly(2)) ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'qmail'], ['mail_sendmailmode', 'smtp', $sendmailMode], - ])); + ]); $this->assertEquals(new \Swift_SendmailTransport('/var/qmail/bin/sendmail' . $binaryParam), self::invokePrivate($this->mailer, 'getSendMailInstance')); } @@ -121,10 +121,10 @@ class MailerTest extends TestCase { public function testGetInstanceSendmail() { $this->config ->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'sendmail'], ['mail_sendmailmode', 'smtp', 'smtp'], - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertInstanceOf(\Swift_Mailer::class, $mailer); @@ -151,7 +151,7 @@ class MailerTest extends TestCase { ->expects($this->any()) ->method('getSystemValue') ->with('mail_send_plaintext_only', false) - ->will($this->returnValue(false)); + ->willReturn(false); $this->assertInstanceOf('\OC\Mail\Message', $this->mailer->createMessage()); } @@ -163,7 +163,7 @@ class MailerTest extends TestCase { ->disableOriginalConstructor()->getMock(); $message->expects($this->once()) ->method('getSwiftMessage') - ->will($this->returnValue(new \Swift_Message())); + ->willReturn(new \Swift_Message()); $this->mailer->send($message); } @@ -199,10 +199,10 @@ class MailerTest extends TestCase { public function testStreamingOptions() { $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'smtp'], ['mail_smtpstreamoptions', [], ['foo' => 1]] - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertEquals(1, count($mailer->getTransport()->getStreamOptions())); $this->assertTrue(isset($mailer->getTransport()->getStreamOptions()['foo'])); @@ -211,10 +211,10 @@ class MailerTest extends TestCase { public function testStreamingOptionsWrongType() { $this->config->method('getSystemValue') - ->will($this->returnValueMap([ + ->willReturnMap([ ['mail_smtpmode', 'smtp', 'smtp'], ['mail_smtpstreamoptions', [], 'bar'] - ])); + ]); $mailer = self::invokePrivate($this->mailer, 'getInstance'); $this->assertEquals(0, count($mailer->getTransport()->getStreamOptions())); } diff --git a/tests/lib/Mail/MessageTest.php b/tests/lib/Mail/MessageTest.php index ab62cfcfdcb..14c24345069 100644 --- a/tests/lib/Mail/MessageTest.php +++ b/tests/lib/Mail/MessageTest.php @@ -80,7 +80,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getFrom') - ->will($this->returnValue($swiftresult)); + ->willReturn($swiftresult); $this->assertSame($return, $this->message->getFrom()); } @@ -117,7 +117,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getTo') - ->will($this->returnValue($swiftresult)); + ->willReturn($swiftresult); $this->assertSame($return, $this->message->getTo()); } @@ -137,7 +137,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getCc') - ->will($this->returnValue($swiftresult)); + ->willReturn($swiftresult); $this->assertSame($return, $this->message->getCc()); } @@ -157,7 +157,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getBcc') - ->will($this->returnValue($swiftresult)); + ->willReturn($swiftresult); $this->assertSame($return, $this->message->getBcc()); } @@ -175,7 +175,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getSubject') - ->will($this->returnValue('Fancy Subject')); + ->willReturn('Fancy Subject'); $this->assertSame('Fancy Subject', $this->message->getSubject()); } @@ -193,7 +193,7 @@ class MessageTest extends TestCase { $this->swiftMessage ->expects($this->once()) ->method('getBody') - ->will($this->returnValue('Fancy Body')); + ->willReturn('Fancy Body'); $this->assertSame('Fancy Body', $this->message->getPlainBody()); } |