Refactore all test to be independent

This commit is contained in:
Jakub Zelenka 2018-05-17 20:15:14 +01:00
parent 3bb4d28798
commit 4aabe3c966
26 changed files with 306 additions and 108 deletions

View file

@ -4,18 +4,24 @@ encrypt and decrypt a text
<?php if(!class_exists("gnupg")) die("skip"); ?>
--FILE--
<?php
require_once(dirname(__FILE__)."/vars.inc");
$gpg = new gnupg();
$gpg -> seterrormode(gnupg::ERROR_WARNING);
$gpg -> addencryptkey($fingerprint);
$enc = $gpg -> encrypt($plaintext);
$gpg = NULL;
require_once "gnupgt.inc";
gnupgt::import_key();
$gpg = new gnupg();
$gpg -> adddecryptkey($fingerprint, $passphrase);
$ret = $gpg -> decrypt ($enc);
$gpg->seterrormode(gnupg::ERROR_WARNING);
$gpg->addencryptkey($fingerprint);
$enc = $gpg->encrypt($plaintext);
$gpg = new gnupg();
$gpg->adddecryptkey($fingerprint, $passphrase);
$ret = $gpg->decrypt($enc);
var_dump($ret);
?>
--EXPECTF--
string(7) "foo bar"
--CLEAN--
<?php
require_once "gnupgt.inc";
gnupgt::delete_key();
?>