44class test extends PHPUnit_Framework_TestCase
55{
66
7- public function testEncryptDecrypt ()
8- {
9-
10- $ message = "1234567890abcdefghijklmnopqrstuvwxyz " ;
11- $ encryptedData = SecureFuncs \SecureFuncs::encrypt ($ message );
12-
13- $ this ->assertArrayHasKey ('Key ' , $ encryptedData );
14-
15- $ this ->assertNotEmpty ($ encryptedData ['Key ' ]);
16-
17- $ this ->assertArrayHasKey ('Encrypted ' , $ encryptedData );
18-
19- $ this ->assertNotEmpty ($ encryptedData ['Encrypted ' ]);
20-
21- $ decryptedText = SecureFuncs \SecureFuncs::decrypt ($ encryptedData ['Encrypted ' ], $ encryptedData ['Key ' ]);
22-
23- $ this ->assertEquals ($ message , $ decryptedText );
24-
25- }
26-
277 public function testRandom ()
288 {
299
@@ -40,7 +20,7 @@ public function testRandom()
4020 public function testPassword ()
4121 {
4222
43- $ password = " qwerty1234567 " ;
23+ $ password = \ SecureFuncs \SecureFuncs:: randomString ( 32 ) ;
4424
4525 $ hash = \SecureFuncs \SecureFuncs::password_hash ($ password );
4626
@@ -55,4 +35,9 @@ public function testOther()
5535 $ this ->assertEquals (9 , \SecureFuncs \SecureFuncs::strlen ('123456789 ' ));
5636 }
5737
38+ public function testCompareStrings ()
39+ {
40+ $ random_string = \SecureFuncs \SecureFuncs::randomString (12 );
41+ $ this ->assertTrue (\SecureFuncs \SecureFuncs::compareStrings ($ random_string , $ random_string ));
42+ }
5843}
0 commit comments