mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-12-23 02:11:40 +00:00
Add initial test for object creation with home dir
This commit is contained in:
parent
2a07550357
commit
2f99f8696a
1 changed files with 31 additions and 0 deletions
31
tests/gnupg_oo_init_home_dir.phpt
Normal file
31
tests/gnupg_oo_init_home_dir.phpt
Normal file
|
@ -0,0 +1,31 @@
|
|||
--TEST--
|
||||
init object with custom home_dir
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
$homedir = __DIR__ . '/init_oo_home';
|
||||
if (!is_dir($homedir)) {
|
||||
mkdir($homedir);
|
||||
}
|
||||
|
||||
$gpg = new gnupg(array('home_dir' => $homedir));
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->import($testkey);
|
||||
$imported = false;
|
||||
foreach (glob("$homedir/*") as $filename) {
|
||||
//var_dump($filename);
|
||||
$imported = true;
|
||||
}
|
||||
var_dump($imported);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
--CLEAN--
|
||||
<?php
|
||||
foreach (glob(__DIR__ . '/init_oo_home/*') as $filename) {
|
||||
unlink($filename);
|
||||
}
|
||||
rmdir($homedir);
|
||||
?>
|
Loading…
Reference in a new issue