3 use PHPUnit\Framework\TestCase;
5 require_once
'cu_func.i';
14 $this->Cu =
"SCRUBCU";
15 $this->key_suffix = sha1($this->Cu.
":urlTestKey");
16 $this->url_data =
"https://ashishsharma.com?x=a&y=b";
19 function test_default_url_encryptions() {
21 if(function_exists(
"hcu_encrypturl_mcrypt") && function_exists(
"hcu_decrypturl_mcrypt")) {
23 $ciphertext = hcu_encrypturl_mcrypt($this->url_data, $this->key_suffix);
25 $obtained_decrypted_text = hcu_decrypturl_mcrypt($ciphertext,
28 $this->assertEquals($obtained_decrypted_text, $this->url_data);
32 $ciphertext_openssl = hcu_encrypturl($this->url_data,
35 $obtained_decrypted_text_openssl = hcu_decrypturl($ciphertext_openssl,
38 $this->assertEquals($obtained_decrypted_text_openssl, $this->url_data);
42 function test_urls_encryption_mcrypt_comptability() {
44 if(function_exists(
"hcu_encrypturl_mcrypt")) {
46 $ciphertext = hcu_encrypturl_mcrypt($this->url_data,
49 $ciphertext = hcu_encrypturl($this->url_data,
54 $obtained_decrypted_text = hcu_decrypturl($ciphertext,
57 $this->assertEquals($obtained_decrypted_text, $this->url_data);