mirror of
https://github.com/php-gnupg/php-gnupg.git
synced 2024-11-21 22:17:09 +00:00
Refactore all test to be independent
This commit is contained in:
parent
3bb4d28798
commit
4aabe3c966
26 changed files with 306 additions and 108 deletions
21
tests/gnupg_oo_deletekey.phpt
Normal file
21
tests/gnupg_oo_deletekey.phpt
Normal file
|
@ -0,0 +1,21 @@
|
|||
--TEST--
|
||||
delete a key from the keyring
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg->deletekey($fingerprint,true);
|
||||
var_dump($ret);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -4,12 +4,13 @@ encrypt and decrypt a text
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->addencryptkey($fingerprint);
|
||||
$enc = $gpg->encrypt($plaintext);
|
||||
$gpg = NULL;
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->adddecryptkey($fingerprint, $passphrase);
|
||||
|
@ -19,3 +20,8 @@ var_dump($ret);
|
|||
?>
|
||||
--EXPECTF--
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
||||
|
|
|
@ -4,16 +4,16 @@ encryptsign and decryptverify a text
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->addencryptkey($fingerprint);
|
||||
$gpg->addsignkey($fingerprint, $passphrase);
|
||||
$enc = $gpg->encryptsign($plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
$plaintext = false;
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->adddecryptkey($fingerprint, $passphrase);
|
||||
$ret = $gpg->decryptverify ($enc, $plaintext);
|
||||
|
@ -38,3 +38,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -4,7 +4,9 @@ export a key
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg->export($fingerprint);
|
||||
|
@ -12,7 +14,6 @@ var_dump($ret);
|
|||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1
|
||||
|
||||
mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3
|
||||
afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z
|
||||
|
@ -36,3 +37,8 @@ drhhPQJw1AY6GEpSbK0JtACeJuewK8C1wO1l5OYkGzFpb4VgquI=
|
|||
=twR+
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
import a new key into the keyring
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
@unlink (dirname(__FILE__)."/pubring.gpg");
|
||||
@unlink (dirname(__FILE__)."/secring.gpg");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg->import($testkey);
|
||||
|
@ -33,3 +33,8 @@ array(9) {
|
|||
["fingerprint"]=>
|
||||
string(40) "64DF06E42FCF2094590CDEEE2E96F141B3DD2B2E"
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -4,7 +4,9 @@ get keyinfo
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg->keyinfo($fingerprint);
|
||||
|
@ -99,3 +101,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
list signatures
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg->listsignatures($fingerprint);
|
||||
|
@ -35,3 +37,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -4,7 +4,9 @@ sign a text with sigmode SIG_MODE_CLEAR
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->setsignmode(gnupg::SIG_MODE_CLEAR);
|
||||
|
@ -38,3 +40,8 @@ array(1) {
|
|||
}
|
||||
string(8) "foo bar
|
||||
"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -4,7 +4,9 @@ sign a text with mode SIG_MODE_DETACH
|
|||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->setsignmode(gnupg::SIG_MODE_DETACH);
|
||||
|
@ -37,3 +39,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,10 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
sign a text with mode SIG_MODE_DETACH and without armored output
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->setarmor(0);
|
||||
|
@ -38,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,10 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
sign a text with mode SIG_MODE_NORMAL
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->setsignmode(gnupg::SIG_MODE_NORMAL);
|
||||
|
@ -38,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,10 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
sign a text with mode SIG_MODE_NORMAL and without armored output
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->seterrormode(gnupg::ERROR_WARNING);
|
||||
$gpg->setarmor(0);
|
||||
|
@ -12,8 +14,6 @@ $gpg -> setsignmode(gnupg::SIG_MODE_NORMAL);
|
|||
$gpg->addsignkey($fingerprint, $passphrase);
|
||||
$ret = $gpg->sign($plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
|
||||
$gpg = new gnupg();
|
||||
//$ret = $gpg->verify($plaintext, $ret);
|
||||
$plaintext = false;
|
||||
|
@ -39,3 +39,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,14 +0,0 @@
|
|||
--TEST--n
|
||||
delete a key from the keyring
|
||||
--SKIPIF--
|
||||
<?php if(!class_exists("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
$gpg = new gnupg();
|
||||
$gpg -> seterrormode(gnupg::ERROR_WARNING);
|
||||
$ret = $gpg -> deletekey($fingerprint,true);
|
||||
var_dump($ret);
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
|
@ -1,10 +1,12 @@
|
|||
--TEST--n
|
||||
--TEST--
|
||||
import a new key into the keyring
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
@unlink (dirname(__FILE__)."/pubring.gpg");
|
||||
@unlink (dirname(__FILE__)."/secring.gpg");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
$ret = gnupg_import($gpg, $testkey);
|
||||
|
@ -31,3 +33,8 @@ array(9) {
|
|||
["fingerprint"]=>
|
||||
string(40) "64DF06E42FCF2094590CDEEE2E96F141B3DD2B2E"
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
delete a key from the keyring
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
$ret = gnupg_deletekey($gpg, $fingerprint,true);
|
||||
|
@ -10,3 +14,8 @@ var_dump($ret);
|
|||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--
|
||||
encrypt and decrypt a text
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_addencryptkey($gpg, $fingerprint);
|
||||
|
@ -18,3 +22,8 @@ var_dump($ret);
|
|||
?>
|
||||
--EXPECTF--
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--
|
||||
encryptsign and decryptverify a text
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_addencryptkey($gpg, $fingerprint);
|
||||
|
@ -36,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--
|
||||
export a key
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
$ret = gnupg_export($gpg, $fingerprint);
|
||||
|
@ -10,7 +14,6 @@ var_dump($ret);
|
|||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1
|
||||
|
||||
mQGiBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3
|
||||
afRj0FNPaVSP0NciPeM4G4uFoQ3lsIf+FBEPXH1D97/XigWObU8K6ha2/s8wU98z
|
||||
|
@ -34,3 +37,8 @@ drhhPQJw1AY6GEpSbK0JtACeJuewK8C1wO1l5OYkGzFpb4VgquI=
|
|||
=twR+
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
get keyinfo
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
$ret = gnupg_keyinfo($gpg, $fingerprint);
|
||||
|
@ -97,3 +101,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
list signatures
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
$ret = gnupg_listsignatures($gpg, $fingerprint);
|
||||
|
@ -33,3 +37,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
}
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,16 +1,18 @@
|
|||
--TEST--n
|
||||
sign a text with sigmode SIG_MODE_CLEAR
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_setsignmode($gpg, GNUPG_SIG_MODE_CLEAR);
|
||||
gnupg_addsignkey($gpg, $fingerprint, $passphrase);
|
||||
$ret = gnupg_sign($gpg, $plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
|
||||
$gpg = gnupg_init();
|
||||
$tmp = false;
|
||||
$ret = gnupg_verify($gpg, $ret, false, $tmp);
|
||||
|
@ -36,3 +38,8 @@ array(1) {
|
|||
}
|
||||
string(8) "foo bar
|
||||
"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,16 +1,18 @@
|
|||
--TEST--n
|
||||
sign a text with mode SIG_MODE_DETACH
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_setsignmode($gpg, GNUPG_SIG_MODE_DETACH);
|
||||
gnupg_addsignkey($gpg, $fingerprint, $passphrase);
|
||||
$ret = gnupg_sign($gpg, $plaintext);
|
||||
|
||||
$gpg = NULL;
|
||||
|
||||
$gpg = gnupg_init();
|
||||
$tmp = false;
|
||||
$ret = gnupg_verify($gpg,$plaintext, $ret);
|
||||
|
@ -35,3 +37,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
sign a text with mode SIG_MODE_DETACH and without armored output
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_setarmor($gpg, 0);
|
||||
|
@ -36,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
sign a text with mode SIG_MODE_NORMAL
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_setsignmode($gpg, GNUPG_SIG_MODE_NORMAL);
|
||||
|
@ -36,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
|
@ -1,8 +1,12 @@
|
|||
--TEST--n
|
||||
sign a text with mode SIG_MODE_NORMAL and without armored output
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("gnupg")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once(dirname(__FILE__)."/vars.inc");
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::import_key();
|
||||
|
||||
$gpg = gnupg_init();
|
||||
gnupg_seterrormode($gpg, GNUPG_ERROR_WARNING);
|
||||
gnupg_setarmor($gpg, 0);
|
||||
|
@ -36,3 +40,8 @@ array(1) {
|
|||
}
|
||||
}
|
||||
string(7) "foo bar"
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once "gnupgt.inc";
|
||||
gnupgt::delete_key();
|
||||
?>
|
21
tests/gnupgt.inc
Normal file
21
tests/gnupgt.inc
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
require_once __DIR__ . "/vars.inc";
|
||||
|
||||
class gnupgt {
|
||||
static function import_key()
|
||||
{
|
||||
global $testkey;
|
||||
|
||||
self::delete_key();
|
||||
|
||||
$gpg = new gnupg();
|
||||
$gpg->import($testkey);
|
||||
}
|
||||
|
||||
static function delete_key()
|
||||
{
|
||||
@unlink(__DIR__ . "/pubring.gpg");
|
||||
@unlink(__DIR__ . "/secring.gpg");
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue