File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -91,17 +91,13 @@ public function testEncrypt()
91
91
$ encrypt = $ class ->getMethod ('encrypt ' );
92
92
$ encrypt ->setAccessible (true );
93
93
94
- $ expected = array (
95
- 'localPublicKey ' => 'BH_1HZcs53fCIMW7Q6ePJqCqc4JIzSeCTjcNBmoet2eMObvQTpiBHH0EnDYZ0kTqk5f2b6wruq7US1vewtngt6o ' ,
96
- 'salt ' => '0HK6QfkQmcQKFVAgG2iOTw ' ,
97
- 'cipherText ' => 'ivmuewrVd-7qkRgxRcu972JyrSvXJzbLeWhTXx1FRZndeP5PVS3fnLQhmK077PgW7C5MLAA_wzDpIN_oB9vo ' ,
98
- );
99
-
100
- $ actualUserPublicKey = 'BDFsuXPNuJ4SxoYcVVvRagonMcSKHXjsif4qmzpXTDyy29ZKqbwtVAgHCLJGP0HgQ0hpkg6H5-fPBvDjBQxjYfc ' ;
101
- $ actualPayload = '{"action":"chatMsg","name":"Bob","msg":"test"} ' ;
102
-
103
- $ actual = $ encrypt ->invokeArgs ($ this ->webPush , array ($ actualUserPublicKey , $ actualPayload ));
104
-
105
- $ this ->assertEquals ($ expected , $ actual );
94
+ $ res = $ encrypt ->invokeArgs ($ this ->webPush , array ($ this ->keys ['standard ' ], 'test ' ));
95
+
96
+ // I can't really test encryption since I don't have the user private key.
97
+ // I can only test if the function executes.
98
+ $ this ->assertArrayHasKey ('cipherText ' , $ res );
99
+ $ this ->assertArrayHasKey ('salt ' , $ res );
100
+ $ this ->assertArrayHasKey ('localPublicKey ' , $ res );
101
+ $ this ->assertEquals (16 , strlen (base64_decode ($ res ['salt ' ]))); // should be 16 bytes
106
102
}
107
103
}
You can’t perform that action at this time.
0 commit comments