File: 005_b.phpt

package info (click to toggle)
php-zstd 0.14.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,536 kB
  • sloc: ansic: 30,009; asm: 382; xml: 179; makefile: 3
file content (48 lines) | stat: -rw-r--r-- 1,102 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--TEST--
zstd_uncompress(): error conditions
--SKIPIF--
<?php
if (PHP_VERSION_ID < 80000) die("skip requires PHP 8.0+");
--FILE--
<?php

echo "*** Testing zstd_uncompress() function with Zero arguments ***", PHP_EOL;
try {
  var_dump( zstd_uncompress() );
} catch (Error $e) {
  echo $e, PHP_EOL;
}

echo "*** Testing with incorrect arguments ***", PHP_EOL;
try {
  var_dump(zstd_uncompress(123));
} catch (Error $e) {
  echo $e, PHP_EOL;
}

class Tester
{}

$testclass = new Tester();
try {
  var_dump(zstd_uncompress($testclass));
} catch (Error $e) {
  echo $e, PHP_EOL;
}
?>
===DONE===
--EXPECTF--
*** Testing zstd_uncompress() function with Zero arguments ***
ArgumentCountError: zstd_uncompress() expects exactly 1 argument, 0 given in %s:%d
Stack trace:
#0 %s(%d): zstd_uncompress()
#1 {main}
*** Testing with incorrect arguments ***

Warning: zstd_uncompress(): it was not compressed by zstd in %s on line %d
bool(false)
TypeError: zstd_uncompress(): Argument #1 ($data) must be of type string, Tester given in %s:%d
Stack trace:
#0 %s(%d): zstd_uncompress(Object(Tester))
#1 {main}
===DONE===