- tests
authorMichael Wallner <mike@php.net>
Sun, 11 Feb 2007 17:44:35 +0000 (17:44 +0000)
committerMichael Wallner <mike@php.net>
Sun, 11 Feb 2007 17:44:35 +0000 (17:44 +0000)
tests/send_data_006.phpt
tests/send_data_007.phpt [new file with mode: 0644]
tests/send_data_008.phpt [new file with mode: 0644]
tests/send_file_006.phpt [new file with mode: 0644]
tests/send_file_007.phpt [new file with mode: 0644]

index 7771b8b9e38714b6438841f7ea49ef3b1ac3d26d..43d7a93ca810d50e067b4b51b5aa21129f8f9e1e 100644 (file)
@@ -9,7 +9,6 @@ checkcgi();
 HTTP_RANGE=bytes=0-3, 4-5,9-11
 --FILE--
 <?php
-$_SERVER['HTTP_RANGE'] = 'bytes=0-3, 4-5,9-11';
 http_send_content_type('text/plain');
 http_send_data(str_repeat('123abc', 1000));
 ?>
diff --git a/tests/send_data_007.phpt b/tests/send_data_007.phpt
new file mode 100644 (file)
index 0000000..91dedaa
--- /dev/null
@@ -0,0 +1,23 @@
+--TEST--
+http_send_data() NIL-NIL range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0
+--FILE--
+<?php
+http_send_content_type('text/plain');
+http_send_data("abc");
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Content-Type: text/plain
+Accept-Ranges: bytes
+Content-Range: bytes 0-0/3
+Content-Length: 1
+
+a
diff --git a/tests/send_data_008.phpt b/tests/send_data_008.phpt
new file mode 100644 (file)
index 0000000..7de621d
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+http_send_data() multiple ranges
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0,-1
+--FILE--
+<?php
+http_send_content_type('text/plain');
+http_send_data("01");
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Type: multipart/byteranges; boundary=%d.%d
+
+
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 0-0/2
+
+0
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 1-1/2
+
+1
+--%d.%d--
diff --git a/tests/send_file_006.phpt b/tests/send_file_006.phpt
new file mode 100644 (file)
index 0000000..e778805
--- /dev/null
@@ -0,0 +1,33 @@
+--TEST--
+http_send_file() first/last byte range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0,-1
+--FILE--
+<?php
+http_send_content_type("text/plain");
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Type: multipart/byteranges; boundary=%d.%d
+
+
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 0-0/1010
+
+0
+--%d.%d
+Content-Type: text/plain
+Content-Range: bytes 1009-1009/1010
+
+
+
+--%d.%d--
diff --git a/tests/send_file_007.phpt b/tests/send_file_007.phpt
new file mode 100644 (file)
index 0000000..1ee12cc
--- /dev/null
@@ -0,0 +1,22 @@
+--TEST--
+http_send_file() NIL-NIL range
+--SKIPIF--
+<?php 
+include 'skip.inc';
+checkcgi();
+?>
+--ENV--
+HTTP_RANGE=bytes=0-0
+--FILE--
+<?php
+http_send_file('data.txt');
+?>
+--EXPECTF--
+Status: 206
+X-Powered-By: PHP/%s
+Accept-Ranges: bytes
+Content-Range: bytes 0-0/1010
+Content-Length: 1
+Content-type: %s
+
+0