Skip to content

Commit

Permalink
Update to Laminas
Browse files Browse the repository at this point in the history
  • Loading branch information
paragonie-security committed Apr 20, 2020
1 parent 7fbaf43 commit fe2e810
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
}
},
"require-dev": {
"phpunit/phpunit": "^6",
"vimeo/psalm": "^1|^2"
"phpunit/phpunit": "^8",
"vimeo/psalm": "^3"
},
"require": {
"php": "^7",
"zendframework/zend-mail": "^2.8",
"php": "^7.2",
"laminas/laminas-mail": "^2.8",
"pear/crypt_gpg": "^1.6"
}
}
6 changes: 0 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
syntaxCheck="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="GPGMailer Test Suite">
<directory suffix="Test.php">./tests</directory>
Expand Down
18 changes: 9 additions & 9 deletions src/GPGMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
declare(strict_types=1);
namespace ParagonIE\GPGMailer;

use Zend\Mail\{
use Laminas\Mail\{
Message,
Transport\TransportInterface
};
Expand Down Expand Up @@ -70,7 +70,7 @@ public function export(string $fingerprint): string
throw new GPGMailerException(
'Could not export fingerprint "' . $fingerprint . '": ' .
$ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand All @@ -97,7 +97,7 @@ public function decrypt(Message $message): Message
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not decrypt message: ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public function encrypt(Message $message, string $fingerprint): Message
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not encrypt message: ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -161,7 +161,7 @@ public function encryptAndSign(Message $message, string $fingerprint): Message
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not encrypt and sign message: ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -195,7 +195,7 @@ public function import(string $gpgKey): string
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not import public key: ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -295,7 +295,7 @@ public function setOption(string $key, $value): self
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not set option "' . $key . '": ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -356,7 +356,7 @@ public function sign(Message $message): Message
} catch (\PEAR_Exception $ex) {
throw new GPGMailerException(
'Could not sign message: ' . $ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down Expand Up @@ -396,7 +396,7 @@ public function verify(Message $message, string $fingerprint): bool
throw new GPGMailerException(
'An error occurred trying to verify this message: ' .
$ex->getMessage(),
$ex->getCode(),
(int) $ex->getCode(),
$ex
);
}
Expand Down
7 changes: 5 additions & 2 deletions tests/GPGMailerTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Zend\Mail\Transport\File;
use Laminas\Mail\Transport\File;
use ParagonIE\GPGMailer\GPGMailer;
use ParagonIE\GPGMailer\GPGMailerException;
use PHPUnit\Framework\TestCase;
Expand All @@ -18,7 +18,7 @@ class GPGMailerTest extends TestCase
/**
* @throws GPGMailerException
*/
public function setUp()
public function setUp(): void
{
if (\is_dir(__DIR__ . '/test/')) {
\rmdir(__DIR__ . '/test/');
Expand All @@ -39,6 +39,9 @@ public function testSetOption()
$this->assertTrue($gm->getOption('invalid key'));

\mkdir(__DIR__ . '/test/', 0400);
if (is_writable(__DIR__ . '/test/')) {
$this->markTestSkipped('Inside virtualbox shared folder.');
}
try {
$gm->setOption('homedir', __DIR__ . '/test/');
$this->fail('No exception thrown');
Expand Down

0 comments on commit fe2e810

Please sign in to comment.