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..7e309d88deb1f --- /dev/null +++ b/ext/openssl/tests/openssl_csr_export_to_file.phpt @@ -0,0 +1,58 @@ +--TEST-- +bool openssl_csr_export_to_file ( resource $csr , string $outfilename [, bool $notext = true ] ) ; +--CREDITS-- +marcosptf - - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- + +--FILE-- + $config); +$crs_exported_file_notext_true = __DIR__ . DIRECTORY_SEPARATOR . "crs-exported-file-notext-true.crs"; +$crs_exported_file_notext_false = __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); + +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-- +bool(true) +bool(true) +bool(true) +bool(true)