File: 002_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 (41 lines) | stat: -rw-r--r-- 957 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
--TEST--
zstd_compress(): error conditions
--SKIPIF--
<?php
if (PHP_VERSION_ID < 80000) die("skip requires PHP 8.0+");
--FILE--
<?php
include(dirname(__FILE__) . '/data.inc');

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

echo "*** Testing with incorrect parameters ***", PHP_EOL;

class Tester {
}

$testclass = new Tester();
try {
  var_dump(zstd_compress($testclass));
} catch (Error $e) {
  echo $e, PHP_EOL;
}
?>
===Done===
--EXPECTF--
*** Testing zstd_compress() function with Zero arguments ***
ArgumentCountError: zstd_compress() expects at least 1 argument, 0 given in %s:%d
Stack trace:
#0 %s(%d): zstd_compress()
#1 {main}
*** Testing with incorrect parameters ***
TypeError: zstd_compress(): Argument #1 ($data) must be of type string, Tester given in %s:%d
Stack trace:
#0 %s(%d): zstd_compress(Object(Tester))
#1 {main}
===Done===