xref: /PHP-7.4/ext/zip/tests/oo_addemptydir.phpt (revision e2e3ddac)
1--TEST--
2ziparchive::addEmptyDir
3--SKIPIF--
4<?php
5if(!extension_loaded('zip')) die('skip');
6?>
7--FILE--
8<?php
9
10$dirname = __DIR__ . '/';
11include $dirname . 'utils.inc';
12$file = $dirname . 'oo_addemptydir.zip';
13
14copy($dirname . 'test.zip', $file);
15
16$zip = new ZipArchive;
17if (!$zip->open($file)) {
18	exit('failed');
19}
20
21$zip->addEmptyDir('emptydir');
22if ($zip->status == ZIPARCHIVE::ER_OK) {
23	if (!verify_entries($zip, [
24		"bar",
25		"foobar/",
26		"foobar/baz",
27		"entry1.txt",
28		"emptydir/"
29	])) {
30		echo "failed\n";
31	} else {
32		echo "OK";
33	}
34	$zip->close();
35} else {
36	echo "failed3\n";
37}
38@unlink($file);
39?>
40--EXPECT--
41OK
42