From a4d469836dfb05ba8a04aedb5a4b82958216441f Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Fri, 6 Jan 2006 16:11:54 +0000 Subject: [PATCH] - Add new tests --- ext/phar/tests/023.phpt | 38 ++++++++++++++++++++++++++++++++++++++ ext/phar/tests/024.phpt | 38 ++++++++++++++++++++++++++++++++++++++ ext/phar/tests/025.phpt | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100755 ext/phar/tests/023.phpt create mode 100755 ext/phar/tests/024.phpt create mode 100755 ext/phar/tests/025.phpt diff --git a/ext/phar/tests/023.phpt b/ext/phar/tests/023.phpt new file mode 100755 index 0000000000..cf6ccf5f5a --- /dev/null +++ b/ext/phar/tests/023.phpt @@ -0,0 +1,38 @@ +--TEST-- +Phar: phar:// file_get_contents +--INI-- +magic_quotes_runtime=0 +--SKIPIF-- + +--FILE-- +"; +$a = ''; +$b = ''; +$bb= ''; + +$manifest = ''; +$manifest .= pack('V', 5) . 'a.php' . pack('VVVV', strlen($a), time(), 0, strlen($a) + 8); +$manifest .= pack('V', 5) . 'b.php' . pack('VVVV', strlen($b), time(), strlen($a) + 8, strlen($b) + 8); +$manifest .= pack('V', 7) . 'b/c.php' . pack('VVVV', strlen($bb), time(), strlen($a.$b) + 16, strlen($bb) + 8); +$file .= pack('VV', strlen($manifest) + 4, 3) . + $manifest . + pack('VV', crc32($a), strlen($a)) . $a . + pack('VV', crc32($b), strlen($b)) . $b . + pack('VV', crc32($bb), strlen($bb)) . $bb; + +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); + +var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php')); +var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php')); +var_dump(file_get_contents('phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php')); + +?> +===DONE=== +--CLEAN-- + +--EXPECT-- +string(28) "" +string(28) "" +string(30) "" +===DONE=== diff --git a/ext/phar/tests/024.phpt b/ext/phar/tests/024.phpt new file mode 100755 index 0000000000..13a9837599 --- /dev/null +++ b/ext/phar/tests/024.phpt @@ -0,0 +1,38 @@ +--TEST-- +Phar: phar:// require +--INI-- +magic_quotes_runtime=0 +--SKIPIF-- + +--FILE-- +"; +$a = ''; +$b = ''; +$bb= ''; + +$manifest = ''; +$manifest .= pack('V', 5) . 'a.php' . pack('VVVV', strlen($a), time(), 0, strlen($a) + 8); +$manifest .= pack('V', 5) . 'b.php' . pack('VVVV', strlen($b), time(), strlen($a) + 8, strlen($b) + 8); +$manifest .= pack('V', 7) . 'b/c.php' . pack('VVVV', strlen($bb), time(), strlen($a.$b) + 16, strlen($bb) + 8); +$file .= pack('VV', strlen($manifest) + 4, 3) . + $manifest . + pack('VV', crc32($a), strlen($a)) . $a . + pack('VV', crc32($b), strlen($b)) . $b . + pack('VV', crc32($bb), strlen($bb)) . $bb; + +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); + +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a.php'; +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b.php'; +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/c.php'; + +?> +===DONE=== +--CLEAN-- + +--EXPECT-- +This is a +This is b +This is b/c +===DONE=== diff --git a/ext/phar/tests/025.phpt b/ext/phar/tests/025.phpt new file mode 100755 index 0000000000..5846322dd2 --- /dev/null +++ b/ext/phar/tests/025.phpt @@ -0,0 +1,38 @@ +--TEST-- +Phar: phar:// require (repeated names) +--INI-- +magic_quotes_runtime=0 +--SKIPIF-- + +--FILE-- +"; +$a = ''; +$b = ''; +$bb= ''; + +$manifest = ''; +$manifest .= pack('V', 1) . 'a' . pack('VVVV', strlen($a), time(), 0, strlen($a) + 8); +$manifest .= pack('V', 1) . 'b' . pack('VVVV', strlen($b), time(), strlen($a) + 8, strlen($b) + 8); +$manifest .= pack('V', 3) . 'b/b' . pack('VVVV', strlen($bb), time(), strlen($a.$b) + 16, strlen($bb) + 8); +$file .= pack('VV', strlen($manifest) + 4, 3) . + $manifest . + pack('VV', crc32($a), strlen($a)) . $a . + pack('VV', crc32($b), strlen($b)) . $b . + pack('VV', crc32($bb), strlen($bb)) . $bb; + +file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file); + +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/a'; +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b'; +include 'phar://' . dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php/b/b'; + +?> +===DONE=== +--CLEAN-- + +--EXPECT-- +This is a +This is b +This is b/b +===DONE=== -- 2.40.0