From 6ee7a9d0908121e5e90d60e7004ded000c6ff083 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Sat, 24 Oct 2015 03:38:16 -0200 Subject: [PATCH 01/12] test to function openssl_csr_export_to_file(); new test to con't covered function; --- .../tests/openssl_csr_export_to_file.phpt | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 ext/openssl/tests/openssl_csr_export_to_file.phpt diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt new file mode 100644 index 0000000000000..a2e515211ae49 --- /dev/null +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -0,0 +1,59 @@ +--TEST-- +bool openssl_csr_export_to_file ( resource $csr , string $outfilename [, bool $notext = true ] ); +--CREDITS-- +marcosptf - +--SKIPIF-- + +--FILE-- + $config); +$crsExportedFileNoTextTrue = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-true.crs"; +$crsExportedFileNoTextFalse = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-false.crs"; + +$dn = array( + "countryName" => "BR", + "stateOrProvinceName" => "Rio Grande do Sul", + "localityName" => "Porto Alegre", + "commonName" => "Marcosptf", + "emailAddress" => "marcosptf@yahoo.com.br" +); + +$args = array( + "digest_alg" => "sha1", + "private_key_bits" => 2048, + "private_key_type" => OPENSSL_KEYTYPE_DSA, + "encrypt_key" => true, + "config" => $config +); + +$privkey = openssl_pkey_new($config_arg); +$csr = openssl_csr_new($dn, $privkey, $args); + +if (openssl_csr_export_to_file($csr, $crsExportedFileNoTextTrue, true)){ + + if (openssl_csr_export_to_file($csr, $crsExportedFileNoTextFalse, false)){ + + if ((file_exists($crsExportedFileNoTextTrue)) && (file_exists($crsExportedFileNoTextFalse))) { + print("okey"); + + } else { + print("export to csr file has failed on create file"); + + } + + } else { + print("export to csr with human readable file has failed"); + + } + +}else{ + print("export to csr file has failed"); + +} +?> +--EXPECT-- +okey From acd7dc047270bd0c2884e1a3e8dbf15791674831 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Mon, 26 Oct 2015 12:39:34 -0200 Subject: [PATCH 02/12] Update openssl_csr_export_to_file.phpt From e2c20987b714f283e3251ba33e231341f76ea30d Mon Sep 17 00:00:00 2001 From: marcosptf Date: Mon, 26 Oct 2015 12:40:25 -0200 Subject: [PATCH 03/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index a2e515211ae49..2538d7325f5ff 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -11,7 +11,7 @@ if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0") $config); -$crsExportedFileNoTextTrue = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-true.crs"; +$crs_exported_file_notext_true = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-true.crs"; $crsExportedFileNoTextFalse = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-false.crs"; $dn = array( From 1c33042db859315a5ef2d22dfead34d58d99dee1 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Mon, 26 Oct 2015 12:41:12 -0200 Subject: [PATCH 04/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 2538d7325f5ff..6ac895e5b1a05 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -33,11 +33,11 @@ $args = array( $privkey = openssl_pkey_new($config_arg); $csr = openssl_csr_new($dn, $privkey, $args); -if (openssl_csr_export_to_file($csr, $crsExportedFileNoTextTrue, true)){ +if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)){ if (openssl_csr_export_to_file($csr, $crsExportedFileNoTextFalse, false)){ - if ((file_exists($crsExportedFileNoTextTrue)) && (file_exists($crsExportedFileNoTextFalse))) { + if ((file_exists($crs_exported_file_notext_true)) && (file_exists($crsExportedFileNoTextFalse))) { print("okey"); } else { From 8e7f482b44fde9052e746d6b23ee8587ac8106d4 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Mon, 26 Oct 2015 12:42:13 -0200 Subject: [PATCH 05/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 6ac895e5b1a05..95256f0bc9454 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -12,7 +12,7 @@ if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0") $config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'; $config_arg = array('config' => $config); $crs_exported_file_notext_true = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-true.crs"; -$crsExportedFileNoTextFalse = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-false.crs"; +$crs_exported_file_notext_false = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-false.crs"; $dn = array( "countryName" => "BR", @@ -35,9 +35,9 @@ $csr = openssl_csr_new($dn, $privkey, $args); if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)){ - if (openssl_csr_export_to_file($csr, $crsExportedFileNoTextFalse, false)){ + if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_false, false)){ - if ((file_exists($crs_exported_file_notext_true)) && (file_exists($crsExportedFileNoTextFalse))) { + if ((file_exists($crs_exported_file_notext_true)) && (file_exists($crs_exported_file_notext_false))) { print("okey"); } else { From 654b883187983dea14ce77c42cd8090a5d0d5921 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Mon, 26 Oct 2015 12:42:53 -0200 Subject: [PATCH 06/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 1 - 1 file changed, 1 deletion(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 95256f0bc9454..76a2ddf0fe744 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -5,7 +5,6 @@ marcosptf - --SKIPIF-- --FILE-- Date: Mon, 26 Oct 2015 12:45:20 -0200 Subject: [PATCH 07/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 76a2ddf0fe744..5096022739418 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -51,7 +51,7 @@ if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)){ }else{ print("export to csr file has failed"); - + } ?> --EXPECT-- From be7ac31ff1c16d2997ab49b18e267fe21d2fdeec Mon Sep 17 00:00:00 2001 From: marcosptf Date: Tue, 27 Oct 2015 03:44:54 -0200 Subject: [PATCH 08/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 5096022739418..be1adec63dcc8 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -54,5 +54,10 @@ if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)){ } ?> +--CLEAN-- + --EXPECT-- okey From 59d3a862bd4e2bd55c497ae9c45abe0d28a69f2a Mon Sep 17 00:00:00 2001 From: marcosptf Date: Tue, 27 Oct 2015 03:47:40 -0200 Subject: [PATCH 09/12] Update openssl_csr_export_to_file.phpt --- .../tests/openssl_csr_export_to_file.phpt | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index be1adec63dcc8..15c4eb516baff 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -32,27 +32,10 @@ $args = array( $privkey = openssl_pkey_new($config_arg); $csr = openssl_csr_new($dn, $privkey, $args); -if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)){ - - if (openssl_csr_export_to_file($csr, $crs_exported_file_notext_false, false)){ - - if ((file_exists($crs_exported_file_notext_true)) && (file_exists($crs_exported_file_notext_false))) { - print("okey"); - - } else { - print("export to csr file has failed on create file"); - - } - - } else { - print("export to csr with human readable file has failed"); - - } - -}else{ - print("export to csr file has failed"); - -} +var_dump(openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)); +var_dump(openssl_csr_export_to_file($csr, $crs_exported_file_notext_false, false)); +var_dump(file_exists($crs_exported_file_notext_true)) +var_dump(file_exists($crs_exported_file_notext_false)); ?> --CLEAN-- --EXPECT-- -okey +bool(true) +bool(true) +bool(true) +bool(true) From add70a694dd1c815892e64ba30e1287fba0f6bd2 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Tue, 27 Oct 2015 04:29:57 -0200 Subject: [PATCH 10/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 15c4eb516baff..6f6e2d088adeb 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -34,13 +34,13 @@ $csr = openssl_csr_new($dn, $privkey, $args); var_dump(openssl_csr_export_to_file($csr, $crs_exported_file_notext_true, true)); var_dump(openssl_csr_export_to_file($csr, $crs_exported_file_notext_false, false)); -var_dump(file_exists($crs_exported_file_notext_true)) +var_dump(file_exists($crs_exported_file_notext_true)); var_dump(file_exists($crs_exported_file_notext_false)); ?> --CLEAN-- --EXPECT-- bool(true) From 1ae00896f49a8a6e45d1c457aceb38606635de79 Mon Sep 17 00:00:00 2001 From: marcosptf Date: Tue, 15 Dec 2015 12:25:32 -0200 Subject: [PATCH 11/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index 6f6e2d088adeb..fda9fbb596752 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -1,7 +1,7 @@ --TEST-- bool openssl_csr_export_to_file ( resource $csr , string $outfilename [, bool $notext = true ] ); --CREDITS-- -marcosptf - +marcosptf - - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --SKIPIF-- --CLEAN-- From a21af2dc15f1e98f6185d266c9fc738537b78b4c Mon Sep 17 00:00:00 2001 From: marcosptf Date: Wed, 16 Dec 2015 14:28:51 -0200 Subject: [PATCH 12/12] Update openssl_csr_export_to_file.phpt --- ext/openssl/tests/openssl_csr_export_to_file.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/openssl/tests/openssl_csr_export_to_file.phpt b/ext/openssl/tests/openssl_csr_export_to_file.phpt index fda9fbb596752..7e309d88deb1f 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -1,5 +1,5 @@ --TEST-- -bool openssl_csr_export_to_file ( resource $csr , string $outfilename [, bool $notext = true ] ); +bool openssl_csr_export_to_file ( resource $csr , string $outfilename [, bool $notext = true ] ) ; --CREDITS-- marcosptf - - #phparty7 - @phpsp - novatec/2015 - sao paulo - br --SKIPIF--