diff --git a/test/AllTests.php b/test/AllTests.php index a49f98e29..29cc7ec37 100644 --- a/test/AllTests.php +++ b/test/AllTests.php @@ -32,6 +32,7 @@ require_once './test/PMA_transformation_getOptions_test.php'; require_once './test/PMA_STR_sub_test.php'; require_once './test/PMA_generateCommonUrl_test.php'; //require_once './test/PMA_arrayWalkRecursive_test.php'; +require_once './test/PMA_blowfish_test.php'; class AllTests { @@ -59,6 +60,7 @@ class AllTests $suite->addTestSuite('PMA_STR_sub_test'); $suite->addTestSuite('PMA_generate_common_url_test'); //$suite->addTestSuite('PMA_arrayWalkRecursive_test'); + $suite->addTestSuite('PMA_blowfish_test'); return $suite; } } diff --git a/test/PMA_blowfish_test.php b/test/PMA_blowfish_test.php new file mode 100644 index 000000000..64e749af3 --- /dev/null +++ b/test/PMA_blowfish_test.php @@ -0,0 +1,59 @@ +assertEquals($string, + PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)); + } + + public function testEncryptDecryptChars() + { + $secret = '$%ÄüfuDFRR'; + $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³'; + $this->assertEquals($string, + PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)); + } + + public function testEncrypt() + { + $secret = '$%ÄüfuDFRR'; + $decrypted = '12345678'; + $encrypted = 'p0nz15awFT4='; + $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret)); + } + + public function testDecrypt() + { + $secret = '$%ÄüfuDFRR'; + $encrypted = 'p0nz15awFT4='; + $decrypted = '12345678'; + $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret)); + } + +} +?>