xref: /PHP-8.4/ext/zip/tests/oo_supported.phpt (revision 74859783)
1--TEST--
2ziparchive::properties isset()/empty() checks
3--EXTENSIONS--
4zip
5--SKIPIF--
6<?php
7/* $Id$ */
8if (!method_exists('ZipArchive', 'isCompressionMethodSupported')) die('skip needs libzip >= 1.7');
9?>
10--FILE--
11<?php
12$methods = [
13    ZipArchive::CM_STORE      => "STORE",
14    ZipArchive::CM_DEFLATE    => "DEFLATE",
15    ZipArchive::CM_BZIP2      => "BZIP2",
16    ZipArchive::CM_XZ         => "XZ",
17];
18foreach($methods as $method => $name) {
19    echo "Compression $name\n";
20    var_dump(ZipArchive::isCompressionMethodSupported($method));
21    var_dump(ZipArchive::isCompressionMethodSupported($method, false));
22}
23
24$methods = [
25    ZipArchive::EM_NONE        => "NONE",
26    ZipArchive::EM_TRAD_PKWARE => "TRAD_PKWARE",
27    ZipArchive::EM_AES_128     => "AES-128",
28    ZipArchive::EM_AES_192     => "AES-192",
29    ZipArchive::EM_AES_256     => "AES-256",
30];
31foreach($methods as $method => $name) {
32    echo "Encryption $name\n";
33    var_dump(ZipArchive::isEncryptionMethodSupported($method));
34    var_dump(ZipArchive::isEncryptionMethodSupported($method, false));
35}
36?>
37Done
38--EXPECTF--
39Compression STORE
40bool(true)
41bool(true)
42Compression DEFLATE
43bool(true)
44bool(true)
45Compression BZIP2
46bool(%s)
47bool(%s)
48Compression XZ
49bool(%s)
50bool(%s)
51Encryption NONE
52bool(true)
53bool(true)
54Encryption TRAD_PKWARE
55bool(true)
56bool(true)
57Encryption AES-128
58bool(%s)
59bool(%s)
60Encryption AES-192
61bool(%s)
62bool(%s)
63Encryption AES-256
64bool(%s)
65bool(%s)
66Done
67