summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2016-02-03 16:20:27 +0000
committerJakub Zelenka <bukka@php.net>2016-02-03 16:20:27 +0000
commit1f3906c1ce24931fac60735c48bff3cfda760409 (patch)
tree4de9540ff04e3011bc04fa5caf964170a1e950c1
parente0332ea1a9d068c3bf0d2b82d8d8b0b06e632c9d (diff)
downloadphp-git-1f3906c1ce24931fac60735c48bff3cfda760409.tar.gz
Rename and clean up OpenSSL tests
-rw-r--r--ext/openssl/tests/002.phpt32
-rw-r--r--ext/openssl/tests/012.phpt27
-rw-r--r--ext/openssl/tests/026.phpt12
-rw-r--r--ext/openssl/tests/cert.csr (renamed from ext/openssl/tests/005_crt.txt)0
-rw-r--r--ext/openssl/tests/openssl_csr_export_bacis.phpt (renamed from ext/openssl/tests/022.phpt)4
-rw-r--r--ext/openssl/tests/openssl_csr_get_subject_basic.phpt (renamed from ext/openssl/tests/005.phpt)2
-rw-r--r--ext/openssl/tests/openssl_csr_new_basic.phpt (renamed from ext/openssl/tests/004.phpt)7
-rw-r--r--ext/openssl/tests/openssl_csr_sign_basic.phpt (renamed from ext/openssl/tests/021.phpt)0
-rw-r--r--ext/openssl/tests/openssl_decrypt_basic.phpt (renamed from ext/openssl/tests/011.phpt)2
-rw-r--r--ext/openssl/tests/openssl_open_basic.phpt (renamed from ext/openssl/tests/013.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pbkdf2_basic.phpt (renamed from ext/openssl/tests/openssl_pbkdf2.phpt)0
-rw-r--r--ext/openssl/tests/openssl_peer_fingerprint_basic.phpt (renamed from ext/openssl/tests/openssl_peer_fingerprint.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt (renamed from ext/openssl/tests/024.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt (renamed from ext/openssl/tests/003.phpt)2
-rw-r--r--ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt (renamed from ext/openssl/tests/023.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pkcs7_sign_basic.phpt (renamed from ext/openssl/tests/025.phpt)3
-rw-r--r--ext/openssl/tests/openssl_pkey_export_basic.phpt (renamed from ext/openssl/tests/027.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pkey_get_details_basic.phpt (renamed from ext/openssl/tests/028.phpt)0
-rw-r--r--ext/openssl/tests/openssl_pkey_new_basic.phpt (renamed from ext/openssl/tests/006.phpt)2
-rw-r--r--ext/openssl/tests/openssl_private_decrypt_basic.phpt (renamed from ext/openssl/tests/017.phpt)0
-rw-r--r--ext/openssl/tests/openssl_private_encrypt_basic.phpt (renamed from ext/openssl/tests/014.phpt)7
-rw-r--r--ext/openssl/tests/openssl_public_decrypt_basic.phpt (renamed from ext/openssl/tests/016.phpt)0
-rw-r--r--ext/openssl/tests/openssl_public_encrypt_basic.phpt (renamed from ext/openssl/tests/015.phpt)7
-rw-r--r--ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt (renamed from ext/openssl/tests/openssl_random_pseudo_bytes.phpt)0
-rw-r--r--ext/openssl/tests/openssl_seal_basic.phpt58
-rw-r--r--ext/openssl/tests/openssl_sign_basic.phpt (renamed from ext/openssl/tests/018.phpt)0
-rw-r--r--ext/openssl/tests/openssl_verify_basic.phpt (renamed from ext/openssl/tests/019.phpt)0
-rw-r--r--ext/openssl/tests/openssl_x509_check_private_key_basic.phpt (renamed from ext/openssl/tests/009.phpt)0
-rw-r--r--ext/openssl/tests/openssl_x509_export_basic.phpt (renamed from ext/openssl/tests/008.phpt)7
-rw-r--r--ext/openssl/tests/openssl_x509_fingerprint_basic.phpt (renamed from ext/openssl/tests/openssl_x509_fingerprint.phpt)0
-rw-r--r--ext/openssl/tests/openssl_x509_parse_v9_basic.phpt (renamed from ext/openssl/tests/openssl_x509_parse_basic_v9.phpt)0
-rw-r--r--ext/openssl/tests/openssl_x509_read_basic.phpt (renamed from ext/openssl/tests/007.phpt)2
32 files changed, 85 insertions, 89 deletions
diff --git a/ext/openssl/tests/002.phpt b/ext/openssl/tests/002.phpt
deleted file mode 100644
index dd4f04a25c..0000000000
--- a/ext/openssl/tests/002.phpt
+++ /dev/null
@@ -1,32 +0,0 @@
---TEST--
-openssl_seal() tests
---SKIPIF--
-<?php if (!extension_loaded("openssl")) print "skip"; ?>
---FILE--
-<?php
-
-$a = 1;
-$b = array(1);
-$c = array(1);
-$d = array(1);
-
-var_dump(openssl_seal($a, $b, $c, $d));
-var_dump(openssl_seal($a, $a, $a, array()));
-var_dump(openssl_seal($c, $c, $c, 1));
-var_dump(openssl_seal($b, $b, $b, ""));
-
-echo "Done\n";
-?>
---EXPECTF--
-Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
-bool(false)
-
-Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
-bool(false)
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
-
-Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
-NULL
-Done
diff --git a/ext/openssl/tests/012.phpt b/ext/openssl/tests/012.phpt
deleted file mode 100644
index dbd03ac0af..0000000000
--- a/ext/openssl/tests/012.phpt
+++ /dev/null
@@ -1,27 +0,0 @@
---TEST--
-openssl_seal() error tests
---SKIPIF--
-<?php if (!extension_loaded("openssl")) print "skip"; ?>
---FILE--
-<?php
-$data = "openssl_open() test";
-$pub_key = "file://" . dirname(__FILE__) . "/public.key";
-$wrong = "wrong";
-
-openssl_seal($data, $sealed, $ekeys, array($pub_key)); // no output
-openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key)); // no output
-openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong));
-openssl_seal($data, $sealed, $ekeys, $pub_key);
-openssl_seal($data, $sealed, $ekeys, array());
-openssl_seal($data, $sealed, $ekeys, array($wrong));
-?>
---EXPECTF--
-
-Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
-
-Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
-
-Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
-
-Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
-
diff --git a/ext/openssl/tests/026.phpt b/ext/openssl/tests/026.phpt
deleted file mode 100644
index 38d626d742..0000000000
--- a/ext/openssl/tests/026.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Options type checks
---SKIPIF--
-<?php if (!extension_loaded("openssl")) print "skip"; ?>
---FILE--
-<?php
-$x = openssl_pkey_new();
-$csr = openssl_csr_new(["countryName" => "DE"], $x, ["x509_extensions" => 0xDEADBEEF]);
-?>
-DONE
---EXPECT--
-DONE
diff --git a/ext/openssl/tests/005_crt.txt b/ext/openssl/tests/cert.csr
index 39084bce05..39084bce05 100644
--- a/ext/openssl/tests/005_crt.txt
+++ b/ext/openssl/tests/cert.csr
diff --git a/ext/openssl/tests/022.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt
index 1fa84d9f42..d3f8842e71 100644
--- a/ext/openssl/tests/022.phpt
+++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt
@@ -14,7 +14,7 @@ $dn = array(
"localityName" => "Porto Alegre",
"commonName" => "Henrique do N. Angelo",
"emailAddress" => "hnangelo@php.net"
- );
+);
$args = array(
"digest_alg" => "sha1",
@@ -22,7 +22,7 @@ $args = array(
"private_key_type" => OPENSSL_KEYTYPE_DSA,
"encrypt_key" => true,
"config" => $config,
- );
+);
$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
diff --git a/ext/openssl/tests/005.phpt b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
index f7fa201561..895ed3695d 100644
--- a/ext/openssl/tests/005.phpt
+++ b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
@@ -8,7 +8,7 @@ if (!function_exists("utf8_decode")) die("skip");
--FILE--
<?php
-$csr = file_get_contents(dirname(__FILE__) . '/005_crt.txt');
+$csr = file_get_contents(dirname(__FILE__) . '/cert.csr');
if ($out = openssl_csr_get_subject($csr, 1)) {
var_dump($out);
}
diff --git a/ext/openssl/tests/004.phpt b/ext/openssl/tests/openssl_csr_new_basic.phpt
index 508ccabc85..a3a4746b39 100644
--- a/ext/openssl/tests/004.phpt
+++ b/ext/openssl/tests/openssl_csr_new_basic.phpt
@@ -11,11 +11,15 @@ var_dump(openssl_csr_new(1,$a,1,1));
$a = array();
var_dump(openssl_csr_new(array(), $a, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'), array()));
-//this leaks
+// this leaks
$a = array(1,2);
$b = array(1,2);
var_dump(openssl_csr_new($a, $b, array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf')));
+// options type check
+$x = openssl_pkey_new();
+var_dump(openssl_csr_new(["countryName" => "DE"], $x, ["x509_extensions" => 0xDEADBEEF]));
+
echo "Done\n";
?>
@@ -31,4 +35,5 @@ Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => p
Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d
bool(false)
resource(%d) of type (OpenSSL X.509 CSR)
+resource(%d) of type (OpenSSL X.509 CSR)
Done
diff --git a/ext/openssl/tests/021.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt
index ae948e3d25..ae948e3d25 100644
--- a/ext/openssl/tests/021.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
diff --git a/ext/openssl/tests/011.phpt b/ext/openssl/tests/openssl_decrypt_basic.phpt
index 118e952a51..1c29767cc5 100644
--- a/ext/openssl/tests/011.phpt
+++ b/ext/openssl/tests/openssl_decrypt_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-openssl_encrypt() and openssl_decrypt() tests
+openssl_decrypt() tests dependent on openssl_encrypt
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
diff --git a/ext/openssl/tests/013.phpt b/ext/openssl/tests/openssl_open_basic.phpt
index 55bb9eb0e3..55bb9eb0e3 100644
--- a/ext/openssl/tests/013.phpt
+++ b/ext/openssl/tests/openssl_open_basic.phpt
diff --git a/ext/openssl/tests/openssl_pbkdf2.phpt b/ext/openssl/tests/openssl_pbkdf2_basic.phpt
index 3ec4dce236..3ec4dce236 100644
--- a/ext/openssl/tests/openssl_pbkdf2.phpt
+++ b/ext/openssl/tests/openssl_pbkdf2_basic.phpt
diff --git a/ext/openssl/tests/openssl_peer_fingerprint.phpt b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
index 743233579a..743233579a 100644
--- a/ext/openssl/tests/openssl_peer_fingerprint.phpt
+++ b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
diff --git a/ext/openssl/tests/024.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
index 5589abb039..5589abb039 100644
--- a/ext/openssl/tests/024.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
diff --git a/ext/openssl/tests/003.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
index 92c8c85b13..0fdb9856eb 100644
--- a/ext/openssl/tests/003.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
@@ -6,7 +6,7 @@ openssl_pkcs7_decrypt() and invalid parameters
<?php
function myErrorHandler($errno, $errstr, $errfile, $errline) {
-var_dump($errstr);
+ var_dump($errstr);
}
set_error_handler("myErrorHandler");
diff --git a/ext/openssl/tests/023.phpt b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
index 5f74f97b0c..5f74f97b0c 100644
--- a/ext/openssl/tests/023.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
diff --git a/ext/openssl/tests/025.phpt b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
index 46c3926fe8..ac8edf19a9 100644
--- a/ext/openssl/tests/025.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
@@ -6,8 +6,9 @@ openssl_pkcs7_sign() tests
<?php
$infile = dirname(__FILE__) . "/cert.crt";
$outfile = tempnam("/tmp", "ssl");
-if ($outfile === false)
+if ($outfile === false) {
die("failed to get a temporary filename!");
+}
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
diff --git a/ext/openssl/tests/027.phpt b/ext/openssl/tests/openssl_pkey_export_basic.phpt
index 8311ab1bd9..8311ab1bd9 100644
--- a/ext/openssl/tests/027.phpt
+++ b/ext/openssl/tests/openssl_pkey_export_basic.phpt
diff --git a/ext/openssl/tests/028.phpt b/ext/openssl/tests/openssl_pkey_get_details_basic.phpt
index 8e0cef46c0..8e0cef46c0 100644
--- a/ext/openssl/tests/028.phpt
+++ b/ext/openssl/tests/openssl_pkey_get_details_basic.phpt
diff --git a/ext/openssl/tests/006.phpt b/ext/openssl/tests/openssl_pkey_new_basic.phpt
index d6e41e496b..3c434978d2 100644
--- a/ext/openssl/tests/006.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-openssl_pkey_new() with an empty sub-array arg generates a malformed resource
+openssl_pkey_new() tests
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
diff --git a/ext/openssl/tests/017.phpt b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
index 76a08b8d55..76a08b8d55 100644
--- a/ext/openssl/tests/017.phpt
+++ b/ext/openssl/tests/openssl_private_decrypt_basic.phpt
diff --git a/ext/openssl/tests/014.phpt b/ext/openssl/tests/openssl_private_encrypt_basic.phpt
index 72ac154058..a2a5152158 100644
--- a/ext/openssl/tests/014.phpt
+++ b/ext/openssl/tests/openssl_private_encrypt_basic.phpt
@@ -8,10 +8,11 @@ $data = "Testing openssl_private_encrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
+
class test {
- function __toString() {
- return "test";
- }
+ function __toString() {
+ return "test";
+ }
}
$obj = new test;
diff --git a/ext/openssl/tests/016.phpt b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
index 42d72b9cd4..42d72b9cd4 100644
--- a/ext/openssl/tests/016.phpt
+++ b/ext/openssl/tests/openssl_public_decrypt_basic.phpt
diff --git a/ext/openssl/tests/015.phpt b/ext/openssl/tests/openssl_public_encrypt_basic.phpt
index 7caa66fa3b..a3c4c57539 100644
--- a/ext/openssl/tests/015.phpt
+++ b/ext/openssl/tests/openssl_public_encrypt_basic.phpt
@@ -8,10 +8,11 @@ $data = "Testing openssl_public_encrypt()";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
+
class test {
- function __toString() {
- return "test";
- }
+ function __toString() {
+ return "test";
+ }
}
$obj = new test;
diff --git a/ext/openssl/tests/openssl_random_pseudo_bytes.phpt b/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt
index ac5a3079a1..ac5a3079a1 100644
--- a/ext/openssl/tests/openssl_random_pseudo_bytes.phpt
+++ b/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt
diff --git a/ext/openssl/tests/openssl_seal_basic.phpt b/ext/openssl/tests/openssl_seal_basic.phpt
new file mode 100644
index 0000000000..4f1958a365
--- /dev/null
+++ b/ext/openssl/tests/openssl_seal_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+openssl_seal() tests
+--SKIPIF--
+<?php if (!extension_loaded("openssl")) print "skip"; ?>
+--FILE--
+<?php
+// simple tests
+$a = 1;
+$b = array(1);
+$c = array(1);
+$d = array(1);
+
+var_dump(openssl_seal($a, $b, $c, $d));
+var_dump(openssl_seal($a, $a, $a, array()));
+var_dump(openssl_seal($c, $c, $c, 1));
+var_dump(openssl_seal($b, $b, $b, ""));
+
+// tests with cert
+$data = "openssl_open() test";
+$pub_key = "file://" . dirname(__FILE__) . "/public.key";
+$wrong = "wrong";
+
+var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key))); // no output
+var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key))); // no output
+var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong)));
+var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key));
+var_dump(openssl_seal($data, $sealed, $ekeys, array()));
+var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong)));
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
+bool(false)
+
+Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
+bool(false)
+
+Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
+NULL
+int(19)
+int(19)
+
+Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
+bool(false)
+
+Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
+NULL
+
+Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
+bool(false)
+
+Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
+bool(false)
+Done
diff --git a/ext/openssl/tests/018.phpt b/ext/openssl/tests/openssl_sign_basic.phpt
index 3d41ee1d34..3d41ee1d34 100644
--- a/ext/openssl/tests/018.phpt
+++ b/ext/openssl/tests/openssl_sign_basic.phpt
diff --git a/ext/openssl/tests/019.phpt b/ext/openssl/tests/openssl_verify_basic.phpt
index a21dfedb01..a21dfedb01 100644
--- a/ext/openssl/tests/019.phpt
+++ b/ext/openssl/tests/openssl_verify_basic.phpt
diff --git a/ext/openssl/tests/009.phpt b/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt
index df18322453..df18322453 100644
--- a/ext/openssl/tests/009.phpt
+++ b/ext/openssl/tests/openssl_x509_check_private_key_basic.phpt
diff --git a/ext/openssl/tests/008.phpt b/ext/openssl/tests/openssl_x509_export_basic.phpt
index 8963864ee5..e0988c095a 100644
--- a/ext/openssl/tests/008.phpt
+++ b/ext/openssl/tests/openssl_x509_export_basic.phpt
@@ -20,8 +20,9 @@ var_dump(openssl_x509_export($d, $output4)); // read cert from a resource
var_dump(openssl_x509_export($e, $output5)); // read an array, fails
$outfilename = tempnam("/tmp", "ssl");
-if ($outfilename === false)
- die("failed to get a temporary filename!");
+if ($outfilename === false) {
+ die("failed to get a temporary filename!");
+}
echo "---\n";
@@ -34,7 +35,7 @@ echo "---\n";
var_dump($exists = file_exists($outfilename));
if ($exists) {
- @unlink($outfilename);
+ @unlink($outfilename);
}
echo "---\n";
diff --git a/ext/openssl/tests/openssl_x509_fingerprint.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
index 6cd464a894..6cd464a894 100644
--- a/ext/openssl/tests/openssl_x509_fingerprint.phpt
+++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
diff --git a/ext/openssl/tests/openssl_x509_parse_basic_v9.phpt b/ext/openssl/tests/openssl_x509_parse_v9_basic.phpt
index 89862eff50..89862eff50 100644
--- a/ext/openssl/tests/openssl_x509_parse_basic_v9.phpt
+++ b/ext/openssl/tests/openssl_x509_parse_v9_basic.phpt
diff --git a/ext/openssl/tests/007.phpt b/ext/openssl/tests/openssl_x509_read_basic.phpt
index 0a74bd3411..cc36e989c6 100644
--- a/ext/openssl/tests/007.phpt
+++ b/ext/openssl/tests/openssl_x509_read_basic.phpt
@@ -1,5 +1,5 @@
--TEST--
-openssl_x509_read() and openssl_x509_free() tests
+openssl_x509_read() tests with testing openssl_x509_free as well
--SKIPIF--
<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--