From 23b2ef0dbcf9f2916c80d146c26bfcc676112528 Mon Sep 17 00:00:00 2001 From: Marv Date: Wed, 15 Jan 2020 17:23:41 +0000 Subject: [PATCH] implementing typed properties, adding getter method as workaround for psalm/phpunit-psalm-plugin#49 --- tests/unit/MailboxTest.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/unit/MailboxTest.php b/tests/unit/MailboxTest.php index 827c7924..9838e0ab 100644 --- a/tests/unit/MailboxTest.php +++ b/tests/unit/MailboxTest.php @@ -22,7 +22,7 @@ final class MailboxTest extends TestCase * * @var string */ - private $imapPath = '{imap.example.com:993/imap/ssl/novalidate-cert}INBOX'; + private string $imapPath = '{imap.example.com:993/imap/ssl/novalidate-cert}INBOX'; /** * Holds the imap username. @@ -31,28 +31,28 @@ final class MailboxTest extends TestCase * * @psalm-var string */ - private $login = 'php-imap@example.com'; + private string $login = 'php-imap@example.com'; /** * Holds the imap user password. * * @var string */ - private $password = 'v3rY!53cEt&P4sSWöRd$'; + private string $password = 'v3rY!53cEt&P4sSWöRd$'; /** * Holds the relative name of the directory, where email attachments will be saved. * * @var string */ - private $attachmentsDir = '.'; + private string $attachmentsDir = '.'; /** * Holds the server encoding setting. * * @var string */ - private $serverEncoding = 'UTF-8'; + private string $serverEncoding = 'UTF-8'; /** * Test, that the constructor trims possible variables @@ -213,6 +213,9 @@ public function testSetAndGetImapSearchOption(): void $mailbox->setImapSearchOption(SE_FREE); $this->assertEquals($mailbox->getImapSearchOption(), 2); + $mailbox->setImapSearchOption(SE_FREE); + $this->assertEquals($mailbox->getImapSearchOption(), 2); + $this->expectException(InvalidParameterException::class); $mailbox->setImapSearchOption(self::ANYTHING);