From 3a7cf40aaa678bea1df143d2982d603b7a334eec Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 27 Nov 2019 15:27:18 +0100 Subject: Mode to modern phpunit Signed-off-by: Roeland Jago Douma --- apps/encryption/tests/Crypto/CryptTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'apps/encryption/tests/Crypto/CryptTest.php') 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']); } -- cgit v1.2.3