mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-12-24 02:31:40 +00:00
35 lines
734 B
Text
35 lines
734 B
Text
|
--TEST--
|
||
|
init resource with custom home_dir
|
||
|
--SKIPIF--
|
||
|
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||
|
--FILE--
|
||
|
<?php
|
||
|
require_once "gnupgt.inc";
|
||
|
$homedir = __DIR__ . '/init_res_home';
|
||
|
if (!is_dir($homedir)) {
|
||
|
mkdir($homedir);
|
||
|
}
|
||
|
|
||
|
$gpg = gnupg_init(array('home_dir' => $homedir));
|
||
|
gnupg_seterrormode($gpg, gnupg::ERROR_WARNING);
|
||
|
gnupg_import($gpg, $testkey);
|
||
|
$imported = false;
|
||
|
foreach (glob("$homedir/*") as $filename) {
|
||
|
$imported = true;
|
||
|
}
|
||
|
var_dump($imported);
|
||
|
$engine = gnupg_getengineinfo($gpg);
|
||
|
var_dump($engine['home_dir'] === $homedir);
|
||
|
?>
|
||
|
--EXPECT--
|
||
|
bool(true)
|
||
|
bool(true)
|
||
|
--CLEAN--
|
||
|
<?php
|
||
|
$homedir = __DIR__ . '/init_res_home';
|
||
|
foreach (glob($homedir . '/*') as $filename) {
|
||
|
unlink($filename);
|
||
|
}
|
||
|
rmdir($homedir);
|
||
|
?>
|