summaryrefslogtreecommitdiffstats
path: root/apps/encryption/tests/Crypto/CryptTest.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 15:27:18 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 15:27:18 +0100
commit3a7cf40aaa678bea1df143d2982d603b7a334eec (patch)
tree63c1e3ad7f7f401d14411a4d44c523632906afc9 /apps/encryption/tests/Crypto/CryptTest.php
parent0568b012672d650c6b5a49e72c4028dde5463c60 (diff)
downloadnextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.tar.gz
nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.zip
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/encryption/tests/Crypto/CryptTest.php')
-rw-r--r--apps/encryption/tests/Crypto/CryptTest.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/encryption/tests/Crypto/CryptTest.php b/apps/encryption/tests/Crypto/CryptTest.php
index 1731f25d532..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(): void {
+ 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']);
}