xref: /PHP-8.0/ext/zip/tests/zip_open_error.phpt (revision 72383cca)
1--TEST--
2zip_open() error conditions
3--CREDITS--
4Birgitte Kvarme <bitta@redpill-linpro.com>
5#PHPTestFest2009 Norway 2009-06-09 \o/
6--SKIPIF--
7<?php
8if(!extension_loaded('zip')) die('skip');
9?>
10--FILE--
11<?php
12echo "Test case 1:";
13try {
14    $zip = zip_open("");
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18
19echo "Test case 2:\n";
20$zip = zip_open("/non_exisitng_directory/test_procedural.zip");
21echo is_resource($zip) ? "OK" : "Failure";
22?>
23--EXPECTF--
24Test case 1:
25Deprecated: Function zip_open() is deprecated in %s on line %d
26zip_open(): Argument #1 ($filename) cannot be empty
27Test case 2:
28
29Deprecated: Function zip_open() is deprecated in %s on line %d
30Failure
31