From feab5e6fa0d1f8d4f2b70345440e7b3a6b5971be Mon Sep 17 00:00:00 2001 From: Jakub Zelenka Date: Thu, 4 Feb 2016 16:51:36 +0000 Subject: Split and clean up OpenSSL X509 tests --- .../openssl_x509_check_private_key_basic.phpt | 4 +- ext/openssl/tests/openssl_x509_export_basic.phpt | 56 +++++----------------- .../tests/openssl_x509_export_to_file_basic.phpt | 42 ++++++++++++++++ .../tests/openssl_x509_fingerprint_basic.phpt | 2 +- ext/openssl/tests/openssl_x509_free_basic.phpt | 16 +++++++ ext/openssl/tests/openssl_x509_parse_basic.phpt | 2 +- ext/openssl/tests/openssl_x509_read_basic.phpt | 37 +++----------- 7 files changed, 80 insertions(+), 79 deletions(-) create mode 100644 ext/openssl/tests/openssl_x509_export_to_file_basic.phpt create mode 100644 ext/openssl/tests/openssl_x509_free_basic.phpt diff --git a/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt b/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt index df18322453..b4842aae18 100644 --- a/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt +++ b/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt @@ -5,11 +5,11 @@ openssl_x509_check_private_key() tests --FILE-- --FILE-- --EXPECTF-- bool(true) @@ -55,19 +34,6 @@ bool(true) Warning: openssl_x509_export(): cannot get cert from parameter 1 in %s on line %d bool(false) ---- -bool(true) -bool(true) - -Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d -bool(false) -bool(true) - -Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d -bool(false) ---- -bool(true) ---- int(0) int(0) int(%d) diff --git a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt new file mode 100644 index 0000000000..68ba93230d --- /dev/null +++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt @@ -0,0 +1,42 @@ +--TEST-- +openssl_x509_export_to_file() tests +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(true) +bool(true) + +Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d +bool(false) +bool(true) + +Warning: openssl_x509_export_to_file(): cannot get cert from parameter 1 in %s on line %d +bool(false) +--- +bool(true) diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt index 6cd464a894..766b158fab 100644 --- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt +++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -Testing openssl_x509_fingerprint() +openssl_x509_fingerprint() tests --SKIPIF-- +--FILE-- + +--EXPECTF-- +resource(%d) of type (OpenSSL X.509) +resource(%d) of type (Unknown) + +Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d diff --git a/ext/openssl/tests/openssl_x509_parse_basic.phpt b/ext/openssl/tests/openssl_x509_parse_basic.phpt index 325b2ee4b9..00e32c3b60 100644 --- a/ext/openssl/tests/openssl_x509_parse_basic.phpt +++ b/ext/openssl/tests/openssl_x509_parse_basic.phpt @@ -1,5 +1,5 @@ --TEST-- -openssl_x509_parse() basic test +openssl_x509_parse() tests --SKIPIF-- --FILE-- @@ -14,47 +14,24 @@ $d = openssl_x509_read($a); $e = array(); $f = array($b); -var_dump($res = openssl_x509_read($a)); // read cert as a string -openssl_x509_free($res); -var_dump($res); -var_dump($res = openssl_x509_read($b)); // read cert as a filename string -openssl_x509_free($res); -var_dump($res); -var_dump($res = openssl_x509_read($c)); // read an invalid cert, fails -openssl_x509_free($res); -var_dump($res); -var_dump($res = openssl_x509_read($d)); // read cert from a resource -openssl_x509_free($res); -var_dump($res); -var_dump($res = openssl_x509_read($e)); // read an array -openssl_x509_free($res); -var_dump($res); -var_dump($res = openssl_x509_read($f)); // read an array with the filename -openssl_x509_free($res); -var_dump($res); +var_dump(openssl_x509_read($a)); // read cert as a string +var_dump(openssl_x509_read($b)); // read cert as a filename string +var_dump(openssl_x509_read($c)); // read an invalid cert, fails +var_dump(openssl_x509_read($d)); // read cert from a resource +var_dump(openssl_x509_read($e)); // read an array +var_dump(openssl_x509_read($f)); // read an array with the filename ?> --EXPECTF-- resource(%d) of type (OpenSSL X.509) -resource(%d) of type (Unknown) resource(%d) of type (OpenSSL X.509) -resource(%d) of type (Unknown) Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d bool(false) - -Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d -bool(false) resource(%d) of type (OpenSSL X.509) -resource(%d) of type (Unknown) Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d bool(false) -Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d -bool(false) - Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in %s on line %d bool(false) -Warning: openssl_x509_free() expects parameter 1 to be resource, boolean given in %s on line %d -bool(false) -- cgit v1.2.1