com php-src: reworked the tests, created test cases for defalte, gzip and unsupported brotli: ext/zlib/tests/zlib_get_coding_type _basic.phpt
ext/zlib/tests/zlib_get_coding_type_b r.phpt ext/zlib/tests/zlib_get_coding_type_deflate .phpt ext/zlib/tests/zlib_get_coding_type_gzip.ph pt
| From: | Christoph Michael Becker | Date: | Thu, 14 Sep 2017 07:17:45 +0000 |
| Subject: | com php-src: reworked the tests, created test cases for defalte, gzip and unsupported brotli: ext/zlib/tests/zlib_get_coding_type _basic.phpt ext/zlib/tests/zlib_get_coding_type_b r.phpt ext/zlib/tests/zlib_get_coding_type_deflate .phpt ext/zlib/tests/zlib_get_coding_type_gzip.ph pt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-99437@lists.php.net to get a copy of this message | ||
Commit: feb16a492beb9908251569a6d1afd7496efb8c4d
Author: Florian Engelhardt <florian.engelhardt@bergfreunde.de> Thu, 14 Sep 2017
09:17:45 +0200
Parents: 9e8eca1d3d5ae5d01b278d368af08a7230a9e16b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=feb16a492beb9908251569a6d1afd7496efb8c4d
Log:
reworked the tests, created test cases for defalte, gzip and unsupported brotli
Changed paths:
M ext/zlib/tests/zlib_get_coding_type_basic.phpt
A ext/zlib/tests/zlib_get_coding_type_br.phpt
A ext/zlib/tests/zlib_get_coding_type_deflate.phpt
A ext/zlib/tests/zlib_get_coding_type_gzip.phpt
Diff:
diff --git a/ext/zlib/tests/zlib_get_coding_type_basic.phpt
b/ext/zlib/tests/zlib_get_coding_type_basic.phpt
index 8e7df25..b31beb1 100644
--- a/ext/zlib/tests/zlib_get_coding_type_basic.phpt
+++ b/ext/zlib/tests/zlib_get_coding_type_basic.phpt
@@ -1,10 +1,15 @@
--TEST--
-test zlib_get_coding_type()
+zlib_get_coding_type() basic call without env
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
---INI--
-zlib.output_compression = Off
--FILE--
-<?php var_dump(zlib_get_coding_type()); ?>
+<?php
+ini_set('zlib.output_compression', 'On');
+$enc = zlib_get_coding_type();
+ini_set('zlib.output_compression', 'Off');
+var_dump($enc);
+var_dump(zlib_get_coding_type());
+?>
--EXPECT--
bool(false)
+bool(false)
diff --git a/ext/zlib/tests/zlib_get_coding_type_br.phpt
b/ext/zlib/tests/zlib_get_coding_type_br.phpt
new file mode 100644
index 0000000..eb636b9
--- /dev/null
+++ b/ext/zlib/tests/zlib_get_coding_type_br.phpt
@@ -0,0 +1,17 @@
+--TEST--
+zlib_get_coding_type() with unsupported encoding
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--ENV--
+HTTP_ACCEPT_ENCODING=br
+--FILE--
+<?php
+ini_set('zlib.output_compression', 'On');
+$enc = zlib_get_coding_type();
+ini_set('zlib.output_compression', 'Off');
+var_dump($enc);
+var_dump(zlib_get_coding_type());
+?>
+--EXPECT--
+bool(false)
+bool(false)
diff --git a/ext/zlib/tests/zlib_get_coding_type_deflate.phpt
b/ext/zlib/tests/zlib_get_coding_type_deflate.phpt
new file mode 100644
index 0000000..0028ec2
--- /dev/null
+++ b/ext/zlib/tests/zlib_get_coding_type_deflate.phpt
@@ -0,0 +1,17 @@
+--TEST--
+zlib_get_coding_type() with deflate encoding
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--ENV--
+HTTP_ACCEPT_ENCODING=deflate
+--FILE--
+<?php
+ini_set('zlib.output_compression', 'On');
+$enc = zlib_get_coding_type();
+ini_set('zlib.output_compression', 'Off');
+var_dump($enc);
+var_dump(zlib_get_coding_type());
+?>
+--EXPECT--
+string(7) "deflate"
+string(7) "deflate"
diff --git a/ext/zlib/tests/zlib_get_coding_type_gzip.phpt
b/ext/zlib/tests/zlib_get_coding_type_gzip.phpt
new file mode 100644
index 0000000..5932ba5
--- /dev/null
+++ b/ext/zlib/tests/zlib_get_coding_type_gzip.phpt
@@ -0,0 +1,17 @@
+--TEST--
+zlib_get_coding_type() with gzip encoding
+--SKIPIF--
+<?php if (!extension_loaded("zlib")) print "skip"; ?>
+--ENV--
+HTTP_ACCEPT_ENCODING=gzip
+--FILE--
+<?php
+ini_set('zlib.output_compression', 'On');
+$enc = zlib_get_coding_type();
+ini_set('zlib.output_compression', 'Off');
+var_dump($enc);
+var_dump(zlib_get_coding_type());
+?>
+--EXPECT--
+string(4) "gzip"
+string(4) "gzip"