diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 15:27:18 +0100 |
commit | 3a7cf40aaa678bea1df143d2982d603b7a334eec (patch) | |
tree | 63c1e3ad7f7f401d14411a4d44c523632906afc9 /tests/lib/Security/CryptoTest.php | |
parent | 0568b012672d650c6b5a49e72c4028dde5463c60 (diff) | |
download | nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.tar.gz nextcloud-server-3a7cf40aaa678bea1df143d2982d603b7a334eec.zip |
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/Security/CryptoTest.php')
-rw-r--r-- | tests/lib/Security/CryptoTest.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/lib/Security/CryptoTest.php b/tests/lib/Security/CryptoTest.php index b0032a555fd..a2c8055750b 100644 --- a/tests/lib/Security/CryptoTest.php +++ b/tests/lib/Security/CryptoTest.php @@ -37,11 +37,11 @@ class CryptoTest extends \Test\TestCase { $this->assertEquals($stringToEncrypt, $this->crypto->decrypt($ciphertext)); } - /** - * @expectedException \Exception - * @expectedExceptionMessage HMAC does not match. - */ + function testWrongPassword() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('HMAC does not match.'); + $stringToEncrypt = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt.'; $ciphertext = $this->crypto->encrypt($stringToEncrypt); $this->crypto->decrypt($ciphertext, 'A wrong password!'); @@ -53,20 +53,20 @@ class CryptoTest extends \Test\TestCase { $this->assertEquals($stringToEncrypt, $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd')); } - /** - * @expectedException \Exception - * @expectedExceptionMessage HMAC does not match. - */ + function testWrongIV() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('HMAC does not match.'); + $encryptedString = '560f5436ba864b9f12f7f7ca6d41c327554a6f2c0a160a03316b202af07c65163274993f3a46e7547c07ba89304f00594a2f3bd99f83859097c58049c39d0d4ade10e0de914ff0604961e7c849d0271ed6c0b23f984ba16e7d033e3305fb0910e7b6a2a65c988d17dbee71d8f953684d|d2kdFUspVjC0o0sr|1a5feacf87eaa6869a6abdfba9a296e7bbad45b6ad89f7dce67cdc98e2da5dc4379cc672cc655e52bbf19599bf59482fbea13a73937697fa656bf10f3fc4f1aa'; $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'); } - /** - * @expectedException \Exception - * @expectedExceptionMessage Authenticated ciphertext could not be decoded. - */ + function testWrongParameters() { + $this->expectException(\Exception::class); + $this->expectExceptionMessage('Authenticated ciphertext could not be decoded.'); + $encryptedString = '1|2'; $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'); } |