Annotation of embedaddon/php/ext/phar/tests/test_signaturealgos.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Phar: verify signature parsing works
3: --SKIPIF--
4: <?php
5: if (!extension_loaded("phar")) die("skip");
6: if (!extension_loaded("hash")) die("skip extension hash conflicts");
7: $arr = Phar::getSupportedSignatures();
8: if (!in_array("OpenSSL", $arr)) die("skip openssl support required");
9: if (!in_array('SHA-256', $arr)) die("skip hash extension loaded shared");
10: ?>
11: --INI--
12: phar.require_hash=0
13: phar.readonly=0
14: --FILE--
15: <?php
16: $a = new Phar(dirname(__FILE__) . '/files/sha1.phar');
17: $r = $a->getSignature();
18: var_dump($r['hash_type']);
19: $a = new Phar(dirname(__FILE__) . '/files/sha512.phar');
20: $r = $a->getSignature();
21: var_dump($r['hash_type']);
22: $a = new Phar(dirname(__FILE__) . '/files/sha256.phar');
23: $r = $a->getSignature();
24: var_dump($r['hash_type']);
25: $a = new Phar(dirname(__FILE__) . '/files/md5.phar');
26: $r = $a->getSignature();
27: var_dump($r['hash_type']);
28: $a = new Phar(dirname(__FILE__) . '/files/openssl.phar');
29: $r = $a->getSignature();
30: var_dump($r['hash_type']);
31: ?>
32: ===DONE===
33: --EXPECT--
34: string(5) "SHA-1"
35: string(7) "SHA-512"
36: string(7) "SHA-256"
37: string(3) "MD5"
38: string(7) "OpenSSL"
39: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>