Skip to content

Commit 43bff60

Browse files
committed
test: add dcz output handler
1 parent ead1b6f commit 43bff60

File tree

6 files changed

+90
-0
lines changed

6 files changed

+90
-0
lines changed

tests/files/ob_data.zstd

1.8 KB
Binary file not shown.

tests/files/ob_dcz.zstd

1.82 KB
Binary file not shown.

tests/ob_dcz_001.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
output handler: dcz
3+
--SKIPIF--
4+
<?php
5+
if (false === stristr(PHP_SAPI, 'cgi')) die('skip need sapi/cgi');
6+
?>
7+
--GET--
8+
ob=dictionary
9+
--ENV--
10+
HTTP_ACCEPT_ENCODING=dcz
11+
HTTP_AVAILABLE_DICTIONARY=:5wg7BLZeirApJAxOdI/QBi8RvwZuIJfPf0TwMo/x/yg=:
12+
--FILE--
13+
<?php
14+
ini_set('zstd.output_compression', 1);
15+
ini_set('zstd.output_compression_dict', dirname(__FILE__) . '/data.dic');
16+
17+
include(dirname(__FILE__) . '/data.inc');
18+
echo "{$data}";
19+
?>
20+
--EXPECT_EXTERNAL--
21+
files/ob_dcz.zstd
22+
--EXPECTHEADERS--
23+
Content-Encoding: dcz
24+
Vary: Accept-Encoding, Available-Dictionary

tests/ob_dcz_002.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
output handler: dcz: invalid available-dictionary
3+
--SKIPIF--
4+
<?php
5+
if (false === stristr(PHP_SAPI, 'cgi')) die('skip need sapi/cgi');
6+
?>
7+
--GET--
8+
ob=dictionary
9+
--ENV--
10+
HTTP_ACCEPT_ENCODING=dcz
11+
--FILE--
12+
<?php
13+
ini_set('zstd.output_compression', 1);
14+
ini_set('zstd.output_compression_dict', dirname(__FILE__) . '/data.dic');
15+
16+
include(dirname(__FILE__) . '/data.inc');
17+
echo "{$data}";
18+
--EXPECTF--
19+
%a
20+
Warning: %s: zstd: not found available-dictionary in Unknown on line 0

tests/ob_dcz_003.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
output handler: dcz: invalid available-dictionary
3+
--SKIPIF--
4+
<?php
5+
if (false === stristr(PHP_SAPI, 'cgi')) die('skip need sapi/cgi');
6+
?>
7+
--GET--
8+
ob=dictionary
9+
--ENV--
10+
HTTP_ACCEPT_ENCODING=dcz
11+
HTTP_AVAILABLE_DICTIONARY=:test:
12+
--FILE--
13+
<?php
14+
ini_set('zstd.output_compression', 1);
15+
ini_set('zstd.output_compression_dict', dirname(__FILE__) . '/data.dic');
16+
17+
include(dirname(__FILE__) . '/data.inc');
18+
echo "{$data}";
19+
?>
20+
--EXPECTF--
21+
%a
22+
Warning: %s: zstd: invalid available-dictionary: request(:test:) != actual(%s) in Unknown on line 0

tests/ob_dcz_004.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
output handler: zstd,dcz: invalid available-dictionary
3+
--SKIPIF--
4+
<?php
5+
if (false === stristr(PHP_SAPI, 'cgi')) die('skip need sapi/cgi');
6+
?>
7+
--GET--
8+
ob=dictionary
9+
--ENV--
10+
HTTP_ACCEPT_ENCODING=zstd,dcz
11+
HTTP_AVAILABLE_DICTIONARY=:test:
12+
--FILE--
13+
<?php
14+
ini_set('zstd.output_compression', 1);
15+
ini_set('zstd.output_compression_dict', dirname(__FILE__) . '/data.dic');
16+
17+
include(dirname(__FILE__) . '/data.inc');
18+
echo "{$data}";
19+
?>
20+
--EXPECT_EXTERNAL--
21+
files/ob_data.zstd
22+
--EXPECTHEADERS--
23+
Content-Encoding: zstd
24+
Vary: Accept-Encoding

0 commit comments

Comments
 (0)