Skip to content

Commit e8311a7

Browse files
committed
test: add dcb output handler
1 parent d757244 commit e8311a7

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

tests/files/ob_data.br

1.52 KB
Binary file not shown.

tests/files/ob_dcb.br

51 Bytes
Binary file not shown.

tests/ob_dcb_001.phpt

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

tests/ob_dcb_002.phpt

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

tests/ob_dcb_003.phpt

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

tests/ob_dcb_004.phpt

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

0 commit comments

Comments
 (0)