php-src/ext/zip/tests/oo_progress.phpt
Nikita Popov 7485978339
Migrate SKIPIF -> EXTENSIONS (#7138)
This is an automated migration of most SKIPIF extension_loaded checks.
2021-06-11 11:57:42 +02:00

41 lines
757 B
PHP

--TEST--
registerProgressCallback
--EXTENSIONS--
zip
--SKIPIF--
<?php
/* $Id$ */
if (!method_exists('ZipArchive', 'registerProgressCallback')) die('skip libzip too old');
?>
--INI--
date.timezone=UTC
--FILE--
<?php
$dirname = dirname(__FILE__) . '/';
$file = $dirname . '__tmp_oo_progress.zip';
@unlink($file);
$zip = new ZipArchive;
if (!$zip->open($file, ZIPARCHIVE::CREATE)) {
exit('failed');
}
var_dump($zip->registerProgressCallback(0.5, function ($r) {
// Only check start/end as intermediate is not reliable
if ($r == 0.0) echo "start\n";
if ($r == 1.0) echo "end\n";
}));
var_dump($zip->addFromString('foo', 'entry #1'));
var_dump($zip->close());
unlink($file);
?>
Done
--EXPECT--
bool(true)
bool(true)
start
end
bool(true)
Done