4
4
class test extends PHPUnit_Framework_TestCase
5
5
{
6
6
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
-
27
7
public function testRandom ()
28
8
{
29
9
@@ -40,7 +20,7 @@ public function testRandom()
40
20
public function testPassword ()
41
21
{
42
22
43
- $ password = " qwerty1234567 " ;
23
+ $ password = \ SecureFuncs \SecureFuncs:: randomString ( 32 ) ;
44
24
45
25
$ hash = \SecureFuncs \SecureFuncs::password_hash ($ password );
46
26
@@ -55,4 +35,9 @@ public function testOther()
55
35
$ this ->assertEquals (9 , \SecureFuncs \SecureFuncs::strlen ('123456789 ' ));
56
36
}
57
37
38
+ public function testCompareStrings ()
39
+ {
40
+ $ random_string = \SecureFuncs \SecureFuncs::randomString (12 );
41
+ $ this ->assertTrue (\SecureFuncs \SecureFuncs::compareStrings ($ random_string , $ random_string ));
42
+ }
58
43
}
0 commit comments