Commit: a97aec16c0320c5737b43ad1c3caf01ea1485874 Author: Tjerk Meesters <datib...@php.net> Fri, 20 Sep 2013 23:28:29 +0800 Committer: Tjerk Meesters <tj...@muvee.com> Fri, 20 Sep 2013 23:29:04 +0800 Parents: 574fe449dc05a11cfe7e6a33b04d3f6557442600 Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a97aec16c0320c5737b43ad1c3caf01ea1485874 Log: Added test case for openssl_x509_digest() Changed paths: A ext/openssl/tests/openssl_x509_digest.phpt Diff: diff --git a/ext/openssl/tests/openssl_x509_digest.phpt b/ext/openssl/tests/openssl_x509_digest.phpt new file mode 100644 index 0000000..98ec009 --- /dev/null +++ b/ext/openssl/tests/openssl_x509_digest.phpt @@ -0,0 +1,39 @@ +--TEST-- +Testing openssl_x509_digest() +--SKIPIF-- +<?php +if (!extension_loaded("openssl")) die("skip"); +?> +--FILE-- +<?php + +$cert = "file://" . dirname(__FILE__) . "/cert.crt"; + +echo "** Testing default functionality **\n"; +var_dump(openssl_x509_digest($cert)); +echo "** Testing hash method md5 **\n"; +var_dump(openssl_x509_digest($cert, 'md5')); + +echo "**Testing raw output md5 **\n"; +var_dump(bin2hex(openssl_x509_digest($cert, 'md5', true))); + +echo "** Testing bad certification **\n"; +var_dump(openssl_x509_digest('123')); +echo "** Testing bad hash method **\n"; +var_dump(openssl_x509_digest($cert, 'xx45')); +--EXPECTF-- +** Testing default functionality ** +string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c" +** Testing hash method md5 ** +string(32) "ac77008e172897e06c0b065294487a67" +**Testing raw output md5 ** +string(32) "ac77008e172897e06c0b065294487a67" +** Testing bad certification ** + +Warning: openssl_x509_digest(): cannot get cert from parameter 1 in %s on line %d +bool(false) +** Testing bad hash method ** + +Warning: openssl_x509_digest(): Unknown signature algorithm in %s on line %d +bool(false) + -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php