diff options
Diffstat (limited to 'apps/encryption/tests/Crypto')
-rw-r--r-- | apps/encryption/tests/Crypto/CryptTest.php | 11 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/DecryptAllTest.php | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptAllTest.php | 2 | ||||
-rw-r--r-- | apps/encryption/tests/Crypto/EncryptionTest.php | 13 |
4 files changed, 16 insertions, 12 deletions
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php index 7ecb017b855..053c4ce8f03 100644 --- a/apps/encryption/tests/Crypto/CryptTest.php +++ b/apps/encryption/tests/Crypto/CryptTest.php @@ -53,7 +53,7 @@ class CryptTest extends TestCase { /** @var Crypt */ private $crypt; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->logger = $this->getMockBuilder(ILogger::class) @@ -132,9 +132,10 @@ class CryptTest extends TestCase { /** * test generateHeader with invalid key format * - * @expectedException \InvalidArgumentException */ public function testGenerateHeaderInvalid() { + $this->expectException(\InvalidArgumentException::class); + $this->crypt->generateHeader('unknown'); } @@ -252,9 +253,10 @@ class CryptTest extends TestCase { /** * @dataProvider dataTestHasSignatureFail - * @expectedException \OCP\Encryption\Exceptions\GenericEncryptionException */ public function testHasSignatureFail($cipher) { + $this->expectException(\OCP\Encryption\Exceptions\GenericEncryptionException::class); + $data = 'encryptedContent00iv001234567890123456xx'; $this->invokePrivate($this->crypt, 'hasSignature', array($data, $cipher)); } @@ -371,9 +373,10 @@ class CryptTest extends TestCase { /** * test exception if cipher is unknown * - * @expectedException \InvalidArgumentException */ public function testGetKeySizeFailure() { + $this->expectException(\InvalidArgumentException::class); + $this->invokePrivate($this->crypt, 'getKeySize', ['foo']); } diff --git a/apps/encryption/tests/Crypto/DecryptAllTest.php b/apps/encryption/tests/Crypto/DecryptAllTest.php index 64e29241a07..1b94d1d96cf 100644 --- a/apps/encryption/tests/Crypto/DecryptAllTest.php +++ b/apps/encryption/tests/Crypto/DecryptAllTest.php @@ -53,7 +53,7 @@ class DecryptAllTest extends TestCase { /** @var QuestionHelper | \PHPUnit_Framework_MockObject_MockObject */ protected $questionHelper; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->util = $this->getMockBuilder(Util::class) diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php index 80ff97f17ee..f8be7210054 100644 --- a/apps/encryption/tests/Crypto/EncryptAllTest.php +++ b/apps/encryption/tests/Crypto/EncryptAllTest.php @@ -90,7 +90,7 @@ class EncryptAllTest extends TestCase { /** @var EncryptAll */ protected $encryptAll; - function setUp() { + protected function setUp(): void { parent::setUp(); $this->setupUser = $this->getMockBuilder(Setup::class) ->disableOriginalConstructor()->getMock(); diff --git a/apps/encryption/tests/Crypto/EncryptionTest.php b/apps/encryption/tests/Crypto/EncryptionTest.php index 1f628ff19c9..94e0729317f 100644 --- a/apps/encryption/tests/Crypto/EncryptionTest.php +++ b/apps/encryption/tests/Crypto/EncryptionTest.php @@ -73,7 +73,7 @@ class EncryptionTest extends TestCase { /** @var \OCP\Files\Storage|\PHPUnit_Framework_MockObject_MockObject */ private $storageMock; - public function setUp() { + protected function setUp(): void { parent::setUp(); $this->storageMock = $this->getMockBuilder(Storage::class) @@ -131,9 +131,10 @@ class EncryptionTest extends TestCase { /** * test if public key from owner is missing * - * @expectedException \OCA\Encryption\Exceptions\PublicKeyMissingException */ public function testEndUser2() { + $this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class); + $this->instance->begin('/foo/bar', 'user2', 'r', array(), array('users' => array('user1', 'user2', 'user3'))); $this->endTest(); } @@ -431,11 +432,11 @@ class EncryptionTest extends TestCase { ); } - /** - * @expectedException \OC\Encryption\Exceptions\DecryptionFailedException - * @expectedExceptionMessage Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you. - */ + public function testDecrypt() { + $this->expectException(\OC\Encryption\Exceptions\DecryptionFailedException::class); + $this->expectExceptionMessage('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.'); + $this->instance->decrypt('abc'); } |