cvs: pear /PHP_Compat/tests E_STRICT.phpt FILE.phpt PATH_SEPARATOR.phpt STD.phpt array-change-key-case_simple.phpt array-chunk_simple.phpt
array-combine_simple.phpt array-diff-assoc_simple.phpt array-udiff-assoc_simple.phpt array-udiff_simple.phpt file-get-contents_simple.phpt
file-put-contents_append.phpt file-put-contents_array.phpt file-put-contents_simple.phpt fprintf_simple.phpt http-build-query_complexarray.phpt
http-build-query_numindex.phpt http-build-query_object.phpt http-build-query_simple.phpt is-a_simple.phpt php-compat-loadconstant_array.phpt
php-compat-loadconstant_simple.phpt php-compat-loadfunction_array.phpt php-compat-loadfunction_simple.phpt scandir_simple.phpt scandir_sort.phpt
str-ireplace_allarray.phpt str-ireplace_search-arr-replace-arr.phpt str-ireplace_search-arr-replace-str.phpt str-ireplace_search-str-replace-arr.phpt
str-ireplace_simple.phpt str-ireplace_subjectarray.phpt str-split_bigchunk.phpt str-split_chunksize.phpt str-split_lessremainder.phpt
str-split_simple.phpt stripos_simple.phpt strripos_offset.phpt strripos_simple.phpt vprintf_simple.phpt vsprintf_simple.phpt
| From: | Aidan Lister | Date: | Sun, 06 Jun 2004 01:26:59 +0000 |
| Subject: | cvs: pear /PHP_Compat/tests E_STRICT.phpt FILE.phpt PATH_SEPARATOR.phpt STD.phpt array-change-key-case_simple.phpt array-chunk_simple.phpt array-combine_simple.phpt array-diff-assoc_simple.phpt array-udiff-assoc_simple.phpt array-udiff_simple.phpt file-get-contents_simple.phpt file-put-contents_append.phpt file-put-contents_array.phpt file-put-contents_simple.phpt fprintf_simple.phpt http-build-query_complexarray.phpt http-build-query_numindex.phpt http-build-query_object.phpt http-build-query_simple.phpt is-a_simple.phpt php-compat-loadconstant_array.phpt php-compat-loadconstant_simple.phpt php-compat-loadfunction_array.phpt php-compat-loadfunction_simple.phpt scandir_simple.phpt scandir_sort.phpt str-ireplace_allarray.phpt str-ireplace_search-arr-replace-arr.phpt str-ireplace_search-arr-replace-str.phpt str-ireplace_search-str-replace-arr.phpt str-ireplace_simple.phpt str-ireplace_subjectarray.phpt str-split_bigchunk.phpt str-split_chunksize.phpt str-split_lessremainder.phpt str-split_simple.phpt stripos_simple.phpt strripos_offset.phpt strripos_simple.phpt vprintf_simple.phpt vsprintf_simple.phpt |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-20278@lists.php.net to get a copy of this message | ||
aidan Sat Jun 5 21:26:59 2004 EDT
Added files:
/pear/PHP_Compat/tests array-change-key-case_simple.phpt
array-chunk_simple.phpt
array-combine_simple.phpt
array-diff-assoc_simple.phpt
array-udiff-assoc_simple.phpt
array-udiff_simple.phpt
file-get-contents_simple.phpt
file-put-contents_append.phpt
file-put-contents_array.phpt
file-put-contents_simple.phpt
fprintf_simple.phpt
http-build-query_complexarray.phpt
http-build-query_numindex.phpt
http-build-query_object.phpt
http-build-query_simple.phpt
is-a_simple.phpt
php-compat-loadconstant_array.phpt
php-compat-loadconstant_simple.phpt
php-compat-loadfunction_array.phpt
php-compat-loadfunction_simple.phpt
scandir_simple.phpt scandir_sort.phpt
str-ireplace_allarray.phpt
str-ireplace_search-arr-replace-arr.phpt
str-ireplace_search-arr-replace-str.phpt
str-ireplace_search-str-replace-arr.phpt
str-ireplace_simple.phpt
str-ireplace_subjectarray.phpt
str-split_bigchunk.phpt
str-split_chunksize.phpt
str-split_lessremainder.phpt
str-split_simple.phpt stripos_simple.phpt
strripos_offset.phpt strripos_simple.phpt
vprintf_simple.phpt vsprintf_simple.phpt
Modified files:
/pear/PHP_Compat/tests E_STRICT.phpt FILE.phpt PATH_SEPARATOR.phpt
STD.phpt
Log:
Initial Commit
http://cvs.php.net/diff.php/pear/PHP_Compat/tests/E_STRICT.phpt?r1=1.3&r2=1.4&ty=u Index: pear/PHP_Compat/tests/E_STRICT.phpt diff -u /dev/null pear/PHP_Compat/tests/E_STRICT.phpt:1.4 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/E_STRICT.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,11 @@ +--TEST-- +PHP_Compat E_STRICT +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('E_STRICT'); + +echo E_STRICT; +?> +--EXPECT-- +2048 \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/FILE.phpt?r1=1.2&r2=1.3&ty=u Index: pear/PHP_Compat/tests/FILE.phpt diff -u /dev/null pear/PHP_Compat/tests/FILE.phpt:1.3 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/FILE.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,19 @@ +--TEST-- +PHP_Compat FILE* +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('FILE'); + +echo FILE_USE_INCLUDE_PATH, "\n"; +echo FILE_IGNORE_NEW_LINES, "\n"; +echo FILE_SKIP_EMPTY_LINES, "\n"; +echo FILE_APPEND, "\n"; +echo FILE_NO_DEFAULT_CONTEXT +?> +--EXPECT-- +1 +2 +4 +8 +16 \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/PATH_SEPARATOR.phpt?r1=1.4&r2=1.5&ty=u Index: pear/PHP_Compat/tests/PATH_SEPARATOR.phpt diff -u /dev/null pear/PHP_Compat/tests/PATH_SEPARATOR.phpt:1.5 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/PATH_SEPARATOR.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,13 @@ +--TEST-- +PHP_Compat PATH_SEPARATOR +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('PATH_SEPARATOR'); + +echo (PATH_SEPARATOR == ';' || PATH_SEPARATOR == ':') ? + 'true' : + 'false'; +?> +--EXPECT-- +true \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/STD.phpt?r1=1.2&r2=1.3&ty=u Index: pear/PHP_Compat/tests/STD.phpt diff -u /dev/null pear/PHP_Compat/tests/STD.phpt:1.3 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/STD.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,15 @@ +--TEST-- +PHP_Compat STD* +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('STD'); + +echo (is_resource(STDIN)) ? 'true' : 'false', "\n"; +echo (is_resource(STDOUT)) ? 'true' : 'false', "\n"; +echo (is_resource(STDERR)) ? 'true' : 'false'; +?> +--EXPECT-- +true +true +true \ No newline at end of file http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-change-key-case_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-change-key-case_simple.phpt +++ pear/PHP_Compat/tests/array-change-key-case_simple.phpt --TEST-- PHP_Compat array_change_key_case() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_change_key_case'); // The array $input_array = array("FirSt" => 1, "SecOnd" => 4); // Default to lower print_r(array_change_key_case($input_array)); // Lower print_r(array_change_key_case($input_array, CASE_LOWER)); // Upper print_r(array_change_key_case($input_array, CASE_UPPER)); ?> --EXPECT-- Array ( [first] => 1 [second] => 4 ) Array ( [first] => 1 [second] => 4 ) Array ( [FIRST] => 1 [SECOND] => 4 ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-chunk_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-chunk_simple.phpt +++ pear/PHP_Compat/tests/array-chunk_simple.phpt --TEST-- PHP_Compat array_chunk() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_chunk'); $input_array = array(2 => 'a', 3 => 'b', 4 => 'c', 5 => 'd', 6 => 'e'); print_r(array_chunk($input_array, 2)); print_r(array_chunk($input_array, 2, true)); ?> --EXPECT-- Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [0] => c [1] => d ) [2] => Array ( [0] => e ) ) Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [2] => c [3] => d ) [2] => Array ( [4] => e ) ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-combine_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-combine_simple.phpt +++ pear/PHP_Compat/tests/array-combine_simple.phpt --TEST-- PHP_Compat array_combine() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_combine'); $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?> --EXPECT-- Array ( [green] => avocado [red] => apple [yellow] => banana ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-diff-assoc_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-diff-assoc_simple.phpt +++ pear/PHP_Compat/tests/array-diff-assoc_simple.phpt --TEST-- PHP_Compat array_diff_assoc() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_diff_assoc'); $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $result = array_diff_assoc($array1, $array2); print_r($result); ?> --EXPECT-- Array ( [b] => brown [c] => blue [0] => red ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt +++ pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt --TEST-- PHP_Compat array_udiff_assoc() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_udiff_assoc'); class cr { var $priv_member; function cr($val) { $this->priv_member = $val; } function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); echo serialize($result); ?> --EXPECT-- a:3:{s:3:"0.1";O:2:"cr":1:{s:11:"priv_member";i:9;}s:3:"0.5";O:2:"cr":1:{s:11:"priv_member";i:12;}i:0;O:2:"cr":1:{s:11:"priv_member";i:23;}} http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-udiff_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-udiff_simple.phpt +++ pear/PHP_Compat/tests/array-udiff_simple.phpt --TEST-- PHP_Compat array_udiff() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_udiff'); class cr { var $priv_member; function cr($val) { $this->priv_member = $val; } function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff($a, $b, array("cr", "comp_func_cr")); echo serialize($result); ?> --EXPECT-- a:2:{s:3:"0.5";O:2:"cr":1:{s:11:"priv_member";i:12;}i:0;O:2:"cr":1:{s:11:"priv_member";i:23;}} http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-get-contents_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-get-contents_simple.phpt +++ pear/PHP_Compat/tests/file-get-contents_simple.phpt --TEST-- PHP_Compat file_get_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_get_contents'); $tmpfname = tempnam('/tmp', 'php'); $handle = fopen($tmpfname, 'w'); fwrite($handle, "test test"); fclose($handle); echo file_get_contents($tmpfname); unlink($tmpfname); ?> --EXPECT-- test test http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_append.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_append.phpt +++ pear/PHP_Compat/tests/file-put-contents_append.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = 'foobar'; $string2 = 'testtest'; $tmpfname = tempnam('/tmp', 'php'); echo file_put_contents($tmpfname, $string), "\n"; echo file_put_contents($tmpfname, $string2, FILE_APPEND), "\n"; echo implode('', file($tmpfname)), "\n"; echo file_put_contents($tmpfname, $string2), "\n"; echo implode('', file($tmpfname)); unlink($tmpfname); ?> --EXPECT-- 6 8 foobartesttest 8 testtest http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_array.phpt +++ pear/PHP_Compat/tests/file-put-contents_array.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = array('foo', 'bar'); $tmpfname = tempnam('/tmp', 'php'); $res = file_put_contents($tmpfname, $string); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $res, "\n"; echo $data; ?> --EXPECT-- 6 foobar http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_simple.phpt +++ pear/PHP_Compat/tests/file-put-contents_simple.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = "abcd"; $tmpfname = tempnam('/tmp', 'php'); $res = file_put_contents($tmpfname, $string); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $res, "\n"; echo $data; ?> --EXPECT-- 4 abcd http://cvs.php.net/co.php/pear/PHP_Compat/tests/fprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/fprintf_simple.phpt +++ pear/PHP_Compat/tests/fprintf_simple.phpt --TEST-- PHP_Compat fprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('fprintf'); $tmpfname = tempnam('/tmp', 'php'); $handle = fopen($tmpfname, 'w'); fprintf($handle, 'The %s went to the %s for %d days', 'dog', 'park', 2); fclose($handle); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $data; ?> --EXPECT-- The dog went to the park for 2 days http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_complexarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_complexarray.phpt +++ pear/PHP_Compat/tests/http-build-query_complexarray.phpt --TEST-- PHP_Compat http_build_query() -- with complex arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('user'=>array('name'=>'Bob Smith', 'age'=>47, 'sex'=>'M', 'dob'=>'5/12/1956'), 'pastimes'=>array('golf', 'opera', 'poker', 'rap'), 'children'=>array('bobby'=>array('age'=>12, 'sex'=>'M'), 'sally'=>array('age'=>8, 'sex'=>'F')), 'CEO'); echo http_build_query($data, 'flags_'); ?> --EXPECT-- user[name]=Bob+Smith&user[age]=47&user[sex]=M&user[dob]=5%2F12%2F1956&pastimes[0]=golf&pastimes[1]=opera&pastimes[2]=poker&pastimes[3]=rap&children[bobby][age]=12&children[bobby][sex]=M&children[sally][age]=8&children[sally][sex]=F&flags_0=CEO http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_numindex.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_numindex.phpt +++ pear/PHP_Compat/tests/http-build-query_numindex.phpt --TEST-- PHP_Compat http_build_query() -- with numerically indexed elements --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('foo', 'bar', 'baz', 'boom', 'cow' => 'milk', 'php' =>'hypertext processor'); echo http_build_query($data); echo "\n"; echo http_build_query($data, 'myvar_'); echo "\n"; ?> --EXPECT-- 0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_object.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_object.phpt +++ pear/PHP_Compat/tests/http-build-query_object.phpt --TEST-- PHP_Compat http_build_query() -- with an object --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); class myClass { var $foo; var $baz; function myClass() { $this->foo = 'bar'; $this->baz = 'boom'; } } $data = new myClass(); echo http_build_query($data); ?> --EXPECT-- foo=bar&baz=boom http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_simple.phpt +++ pear/PHP_Compat/tests/http-build-query_simple.phpt --TEST-- PHP_Compat http_build_query() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo http_build_query($data); ?> --EXPECT-- foo=bar&baz=boom&cow=milk&php=hypertext+processor http://cvs.php.net/co.php/pear/PHP_Compat/tests/is-a_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/is-a_simple.phpt +++ pear/PHP_Compat/tests/is-a_simple.phpt --TEST-- PHP_Compat is_a() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('is_a'); class WidgetFactory { var $oink = 'moo'; } $wf = new WidgetFactory(); if (is_a($wf, 'WidgetFactory')) { echo 'true'; } ?> --EXPECT-- true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt +++ pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt --TEST-- PHP_Compat::loadConstant() -- load an array of constants --FILE-- <?php require_once ('PHP/Compat.php'); $comps = array('invalid', 'also-invalid', 'more-invalid', 'E_STRICT'); $res = PHP_Compat::loadConstant($comps); foreach ($res as $value) { echo ($value === false) ? 'false' : 'true', "\n"; } ?> --EXPECT-- false false false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt +++ pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt --TEST-- PHP_Compat::loadConstant() -- load invalid and valid function --FILE-- <?php require_once ('PHP/Compat.php'); $res = PHP_Compat::loadConstant('invalid'); echo ($res === false) ? 'false' : 'true', "\n"; $res = PHP_Compat::loadConstant('E_STRICT'); echo ($res === false) ? 'false' : 'true'; ?> --EXPECT-- false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt +++ pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt --TEST-- PHP_Compat::loadFunction() -- load an array of functions --FILE-- <?php require_once ('PHP/Compat.php'); $comps = array('invalid', 'also-invalid', 'more-invalid', 'str_split'); $res = PHP_Compat::loadFunction($comps); foreach ($res as $value) { echo ($value === false) ? 'false' : 'true', "\n"; } ?> --EXPECT-- false false false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt +++ pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt --TEST-- PHP_Compat::loadFunction() -- load invalid and valid function --FILE-- <?php require_once ('PHP/Compat.php'); $res = PHP_Compat::loadFunction('invalid'); echo ($res === false) ? 'false' : 'true', "\n"; $res = PHP_Compat::loadFunction('str_split'); echo ($res === false) ? 'false' : 'true'; ?> --EXPECT-- false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/scandir_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/scandir_simple.phpt +++ pear/PHP_Compat/tests/scandir_simple.phpt --TEST-- PHP_Compat scandir() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('scandir'); // Create a folder and fill it with files mkdir('tmp'); touch('tmp/test1'); touch('tmp/test2'); // Scan it $dir = 'tmp'; $files = scandir($dir); // List the results print_r($files); // Remove the files unlink('tmp/test1'); unlink('tmp/test2'); rmdir('tmp'); ?> --EXPECT-- Array ( [0] => . [1] => .. [2] => test1 [3] => test2 ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/scandir_sort.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/scandir_sort.phpt +++ pear/PHP_Compat/tests/scandir_sort.phpt --TEST-- PHP_Compat scandir() -- with sorting --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('scandir'); // Create a folder and fill it with files mkdir('tmp'); touch('tmp/test1'); touch('tmp/test2'); // Scan it $dir = 'tmp'; $files = scandir($dir, 1); // List the results print_r($files); // Remove the files unlink('tmp/test1'); unlink('tmp/test2'); rmdir('tmp'); ?> --EXPECT-- Array ( [0] => test2 [1] => test1 [2] => .. [3] => . ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_allarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_allarray.phpt +++ pear/PHP_Compat/tests/str-ireplace_allarray.phpt --TEST-- PHP_Compat str_ireplace() -- All params as arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = array('frog', 'gate', 'beer'); $subject = array('A {animal}', 'The {object}', 'My {thing}'); print_r(str_ireplace($search, $replace, $subject)); ?> --EXPECT-- Array ( [0] => A frog [1] => The gate [2] => My beer ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt --TEST-- PHP_Compat str_ireplace() -- Search and Replace as arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); // Simple $search = array('{ANIMAL}', '{OBJECT}'); $replace = array('frog', 'gate'); $subject = 'The {animal} jumped over the {object}'; echo str_ireplace($search, $replace, $subject), "\n"; // More in search $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = array('frog', 'gate'); $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject), "\n"; // More in replace $search = array('{ANIMAL}', '{OBJECT}'); $replace = array('frog', 'gate', 'door'); $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The frog jumped over the gate The frog jumped over the gate and the ... The frog jumped over the gate and the {thing}... http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt --TEST-- PHP_Compat str_ireplace() -- Search as array, Replace as string --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = 'frog'; $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The frog jumped over the frog and the frog... http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt --TEST-- PHP_Compat str_ireplace() -- Search as string, replace as array --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = '{object}'; $replace = array('cat', 'dog', 'tiger'); $subject = 'The dog jumped over the {object}'; // Supress the error, no way of knowing how it'll turn out on the users machine echo @str_ireplace($search, $replace, $subject); ?> --EXPECT-- The dog jumped over the Array http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_simple.phpt +++ pear/PHP_Compat/tests/str-ireplace_simple.phpt --TEST-- PHP_Compat str_ireplace() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = '{object}'; $replace = 'fence'; $subject = 'The dog jumped over the {object}'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The dog jumped over the fence http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt +++ pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt --TEST-- PHP_Compat str_ireplace() -- With the subject as an array --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); // As a full array $search = '{SUBJECT}'; $replace = 'Lady'; $subject = array('A {subject}', 'The {subject}', 'My {subject}'); print_r(str_ireplace($search, $replace, $subject)); // As a single array $search = '{SUBJECT}'; $replace = 'Lady'; $subject = array('The dog jumped over the {object}'); print_r(str_ireplace($search, $replace, $subject)); ?> --EXPECT-- Array ( [0] => A Lady [1] => The Lady [2] => My Lady ) Array ( [0] => The dog jumped over the {object} ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_bigchunk.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_bigchunk.phpt +++ pear/PHP_Compat/tests/str-split_bigchunk.phpt --TEST-- PHP_Compat str_split() -- chunk size bigger than the string --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "abcd"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => abc [1] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_chunksize.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_chunksize.phpt +++ pear/PHP_Compat/tests/str-split_chunksize.phpt --TEST-- PHP_Compat str_split() -- with a chunk size specified --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "Hello Friend"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => Hel [1] => lo [2] => Fri [3] => end ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_lessremainder.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_lessremainder.phpt +++ pear/PHP_Compat/tests/str-split_lessremainder.phpt --TEST-- PHP_Compat str_split() -- string that has a remainder less than the chunk size --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "abcd"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => abc [1] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_simple.phpt +++ pear/PHP_Compat/tests/str-split_simple.phpt --TEST-- PHP_Compat str_split() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "Hello Friend"; $arr = str_split($str); print_r($arr); ?> --EXPECT-- Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/stripos_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/stripos_simple.phpt +++ pear/PHP_Compat/tests/stripos_simple.phpt --TEST-- PHP_Compat stripos() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('stripos'); $haystack = 'Cat Dog Lion Mouse Sheep Wolf Cat Dog'; $needle = 'DOG'; echo stripos($haystack, $needle, 3); ?> --EXPECT-- 4 http://cvs.php.net/co.php/pear/PHP_Compat/tests/strripos_offset.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/strripos_offset.phpt +++ pear/PHP_Compat/tests/strripos_offset.phpt --TEST-- PHP_Compat strripos() -- with an offset --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('strripos'); $haystack = 'Cat Dog Lion Mouse Dog Sheep Wolf Cat Dog'; $needle = 'DOG'; var_dump(strripos($haystack, $needle, 3)); var_dump(strripos($haystack, $needle, 30)); var_dump(strripos($haystack, $needle, 45)); var_dump(strripos($haystack, $needle, -1)); var_dump(strripos($haystack, $needle, -10)); var_dump(strripos($haystack, $needle, -30)); var_dump(strripos($haystack, $needle, -40)); ?> --EXPECT-- int(34) int(34) bool(false) int(34) int(4) int(4) bool(false) http://cvs.php.net/co.php/pear/PHP_Compat/tests/strripos_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/strripos_simple.phpt +++ pear/PHP_Compat/tests/strripos_simple.phpt --TEST-- PHP_Compat strripos() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('strripos'); $haystack = 'Cat Dog Lion Mouse Sheep Wolf Cat Dog'; $needle = 'DOG'; echo strripos($haystack, $needle); ?> --EXPECT-- 34 http://cvs.php.net/co.php/pear/PHP_Compat/tests/vprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/vprintf_simple.phpt +++ pear/PHP_Compat/tests/vprintf_simple.phpt --TEST-- PHP_Compat vprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('vprintf'); $values = array (2, 'car'); $format = "There are %d monkeys in the %s"; vprintf($format, $values); ?> --EXPECT-- There are 2 monkeys in car http://cvs.php.net/co.php/pear/PHP_Compat/tests/vsprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/vsprintf_simple.phpt +++ pear/PHP_Compat/tests/vsprintf_simple.phpt --TEST-- PHP_Compat vsprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('vsprintf'); $values = array (2, 'car'); $format = "There are %d monkeys in the %s"; vprintf($format, $values); ?> --EXPECT-- There are 2 monkeys in car
http://cvs.php.net/diff.php/pear/PHP_Compat/tests/E_STRICT.phpt?r1=1.3&r2=1.4&ty=u Index: pear/PHP_Compat/tests/E_STRICT.phpt diff -u /dev/null pear/PHP_Compat/tests/E_STRICT.phpt:1.4 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/E_STRICT.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,11 @@ +--TEST-- +PHP_Compat E_STRICT +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('E_STRICT'); + +echo E_STRICT; +?> +--EXPECT-- +2048 \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/FILE.phpt?r1=1.2&r2=1.3&ty=u Index: pear/PHP_Compat/tests/FILE.phpt diff -u /dev/null pear/PHP_Compat/tests/FILE.phpt:1.3 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/FILE.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,19 @@ +--TEST-- +PHP_Compat FILE* +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('FILE'); + +echo FILE_USE_INCLUDE_PATH, "\n"; +echo FILE_IGNORE_NEW_LINES, "\n"; +echo FILE_SKIP_EMPTY_LINES, "\n"; +echo FILE_APPEND, "\n"; +echo FILE_NO_DEFAULT_CONTEXT +?> +--EXPECT-- +1 +2 +4 +8 +16 \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/PATH_SEPARATOR.phpt?r1=1.4&r2=1.5&ty=u Index: pear/PHP_Compat/tests/PATH_SEPARATOR.phpt diff -u /dev/null pear/PHP_Compat/tests/PATH_SEPARATOR.phpt:1.5 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/PATH_SEPARATOR.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,13 @@ +--TEST-- +PHP_Compat PATH_SEPARATOR +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('PATH_SEPARATOR'); + +echo (PATH_SEPARATOR == ';' || PATH_SEPARATOR == ':') ? + 'true' : + 'false'; +?> +--EXPECT-- +true \ No newline at end of file http://cvs.php.net/diff.php/pear/PHP_Compat/tests/STD.phpt?r1=1.2&r2=1.3&ty=u Index: pear/PHP_Compat/tests/STD.phpt diff -u /dev/null pear/PHP_Compat/tests/STD.phpt:1.3 --- /dev/null Sat Jun 5 21:26:59 2004 +++ pear/PHP_Compat/tests/STD.phpt Sat Jun 5 21:26:59 2004 @@ -0,0 +1,15 @@ +--TEST-- +PHP_Compat STD* +--FILE-- +<?php +require_once ('PHP/Compat.php'); +PHP_Compat::loadConstant('STD'); + +echo (is_resource(STDIN)) ? 'true' : 'false', "\n"; +echo (is_resource(STDOUT)) ? 'true' : 'false', "\n"; +echo (is_resource(STDERR)) ? 'true' : 'false'; +?> +--EXPECT-- +true +true +true \ No newline at end of file http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-change-key-case_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-change-key-case_simple.phpt +++ pear/PHP_Compat/tests/array-change-key-case_simple.phpt --TEST-- PHP_Compat array_change_key_case() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_change_key_case'); // The array $input_array = array("FirSt" => 1, "SecOnd" => 4); // Default to lower print_r(array_change_key_case($input_array)); // Lower print_r(array_change_key_case($input_array, CASE_LOWER)); // Upper print_r(array_change_key_case($input_array, CASE_UPPER)); ?> --EXPECT-- Array ( [first] => 1 [second] => 4 ) Array ( [first] => 1 [second] => 4 ) Array ( [FIRST] => 1 [SECOND] => 4 ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-chunk_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-chunk_simple.phpt +++ pear/PHP_Compat/tests/array-chunk_simple.phpt --TEST-- PHP_Compat array_chunk() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_chunk'); $input_array = array(2 => 'a', 3 => 'b', 4 => 'c', 5 => 'd', 6 => 'e'); print_r(array_chunk($input_array, 2)); print_r(array_chunk($input_array, 2, true)); ?> --EXPECT-- Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [0] => c [1] => d ) [2] => Array ( [0] => e ) ) Array ( [0] => Array ( [0] => a [1] => b ) [1] => Array ( [2] => c [3] => d ) [2] => Array ( [4] => e ) ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-combine_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-combine_simple.phpt +++ pear/PHP_Compat/tests/array-combine_simple.phpt --TEST-- PHP_Compat array_combine() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_combine'); $a = array('green', 'red', 'yellow'); $b = array('avocado', 'apple', 'banana'); $c = array_combine($a, $b); print_r($c); ?> --EXPECT-- Array ( [green] => avocado [red] => apple [yellow] => banana ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-diff-assoc_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-diff-assoc_simple.phpt +++ pear/PHP_Compat/tests/array-diff-assoc_simple.phpt --TEST-- PHP_Compat array_diff_assoc() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_diff_assoc'); $array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); $array2 = array("a" => "green", "yellow", "red"); $result = array_diff_assoc($array1, $array2); print_r($result); ?> --EXPECT-- Array ( [b] => brown [c] => blue [0] => red ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt +++ pear/PHP_Compat/tests/array-udiff-assoc_simple.phpt --TEST-- PHP_Compat array_udiff_assoc() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_udiff_assoc'); class cr { var $priv_member; function cr($val) { $this->priv_member = $val; } function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff_assoc($a, $b, array("cr", "comp_func_cr")); echo serialize($result); ?> --EXPECT-- a:3:{s:3:"0.1";O:2:"cr":1:{s:11:"priv_member";i:9;}s:3:"0.5";O:2:"cr":1:{s:11:"priv_member";i:12;}i:0;O:2:"cr":1:{s:11:"priv_member";i:23;}} http://cvs.php.net/co.php/pear/PHP_Compat/tests/array-udiff_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/array-udiff_simple.phpt +++ pear/PHP_Compat/tests/array-udiff_simple.phpt --TEST-- PHP_Compat array_udiff() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('array_udiff'); class cr { var $priv_member; function cr($val) { $this->priv_member = $val; } function comp_func_cr($a, $b) { if ($a->priv_member === $b->priv_member) return 0; return ($a->priv_member > $b->priv_member)? 1:-1; } } $a = array("0.1" => new cr(9), "0.5" => new cr(12), 0 => new cr(23), 1=> new cr(4), 2 => new cr(-15),); $b = array("0.2" => new cr(9), "0.5" => new cr(22), 0 => new cr(3), 1=> new cr(4), 2 => new cr(-15),); $result = array_udiff($a, $b, array("cr", "comp_func_cr")); echo serialize($result); ?> --EXPECT-- a:2:{s:3:"0.5";O:2:"cr":1:{s:11:"priv_member";i:12;}i:0;O:2:"cr":1:{s:11:"priv_member";i:23;}} http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-get-contents_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-get-contents_simple.phpt +++ pear/PHP_Compat/tests/file-get-contents_simple.phpt --TEST-- PHP_Compat file_get_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_get_contents'); $tmpfname = tempnam('/tmp', 'php'); $handle = fopen($tmpfname, 'w'); fwrite($handle, "test test"); fclose($handle); echo file_get_contents($tmpfname); unlink($tmpfname); ?> --EXPECT-- test test http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_append.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_append.phpt +++ pear/PHP_Compat/tests/file-put-contents_append.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = 'foobar'; $string2 = 'testtest'; $tmpfname = tempnam('/tmp', 'php'); echo file_put_contents($tmpfname, $string), "\n"; echo file_put_contents($tmpfname, $string2, FILE_APPEND), "\n"; echo implode('', file($tmpfname)), "\n"; echo file_put_contents($tmpfname, $string2), "\n"; echo implode('', file($tmpfname)); unlink($tmpfname); ?> --EXPECT-- 6 8 foobartesttest 8 testtest http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_array.phpt +++ pear/PHP_Compat/tests/file-put-contents_array.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = array('foo', 'bar'); $tmpfname = tempnam('/tmp', 'php'); $res = file_put_contents($tmpfname, $string); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $res, "\n"; echo $data; ?> --EXPECT-- 6 foobar http://cvs.php.net/co.php/pear/PHP_Compat/tests/file-put-contents_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/file-put-contents_simple.phpt +++ pear/PHP_Compat/tests/file-put-contents_simple.phpt --TEST-- PHP_Compat file_put_contents() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('file_put_contents'); $string = "abcd"; $tmpfname = tempnam('/tmp', 'php'); $res = file_put_contents($tmpfname, $string); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $res, "\n"; echo $data; ?> --EXPECT-- 4 abcd http://cvs.php.net/co.php/pear/PHP_Compat/tests/fprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/fprintf_simple.phpt +++ pear/PHP_Compat/tests/fprintf_simple.phpt --TEST-- PHP_Compat fprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('fprintf'); $tmpfname = tempnam('/tmp', 'php'); $handle = fopen($tmpfname, 'w'); fprintf($handle, 'The %s went to the %s for %d days', 'dog', 'park', 2); fclose($handle); $data = implode('', file($tmpfname)); unlink($tmpfname); echo $data; ?> --EXPECT-- The dog went to the park for 2 days http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_complexarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_complexarray.phpt +++ pear/PHP_Compat/tests/http-build-query_complexarray.phpt --TEST-- PHP_Compat http_build_query() -- with complex arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('user'=>array('name'=>'Bob Smith', 'age'=>47, 'sex'=>'M', 'dob'=>'5/12/1956'), 'pastimes'=>array('golf', 'opera', 'poker', 'rap'), 'children'=>array('bobby'=>array('age'=>12, 'sex'=>'M'), 'sally'=>array('age'=>8, 'sex'=>'F')), 'CEO'); echo http_build_query($data, 'flags_'); ?> --EXPECT-- user[name]=Bob+Smith&user[age]=47&user[sex]=M&user[dob]=5%2F12%2F1956&pastimes[0]=golf&pastimes[1]=opera&pastimes[2]=poker&pastimes[3]=rap&children[bobby][age]=12&children[bobby][sex]=M&children[sally][age]=8&children[sally][sex]=F&flags_0=CEO http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_numindex.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_numindex.phpt +++ pear/PHP_Compat/tests/http-build-query_numindex.phpt --TEST-- PHP_Compat http_build_query() -- with numerically indexed elements --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('foo', 'bar', 'baz', 'boom', 'cow' => 'milk', 'php' =>'hypertext processor'); echo http_build_query($data); echo "\n"; echo http_build_query($data, 'myvar_'); echo "\n"; ?> --EXPECT-- 0=foo&1=bar&2=baz&3=boom&cow=milk&php=hypertext+processor myvar_0=foo&myvar_1=bar&myvar_2=baz&myvar_3=boom&cow=milk&php=hypertext+processor http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_object.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_object.phpt +++ pear/PHP_Compat/tests/http-build-query_object.phpt --TEST-- PHP_Compat http_build_query() -- with an object --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); class myClass { var $foo; var $baz; function myClass() { $this->foo = 'bar'; $this->baz = 'boom'; } } $data = new myClass(); echo http_build_query($data); ?> --EXPECT-- foo=bar&baz=boom http://cvs.php.net/co.php/pear/PHP_Compat/tests/http-build-query_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/http-build-query_simple.phpt +++ pear/PHP_Compat/tests/http-build-query_simple.phpt --TEST-- PHP_Compat http_build_query() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('http_build_query'); $data = array('foo'=>'bar', 'baz'=>'boom', 'cow'=>'milk', 'php'=>'hypertext processor'); echo http_build_query($data); ?> --EXPECT-- foo=bar&baz=boom&cow=milk&php=hypertext+processor http://cvs.php.net/co.php/pear/PHP_Compat/tests/is-a_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/is-a_simple.phpt +++ pear/PHP_Compat/tests/is-a_simple.phpt --TEST-- PHP_Compat is_a() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('is_a'); class WidgetFactory { var $oink = 'moo'; } $wf = new WidgetFactory(); if (is_a($wf, 'WidgetFactory')) { echo 'true'; } ?> --EXPECT-- true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt +++ pear/PHP_Compat/tests/php-compat-loadconstant_array.phpt --TEST-- PHP_Compat::loadConstant() -- load an array of constants --FILE-- <?php require_once ('PHP/Compat.php'); $comps = array('invalid', 'also-invalid', 'more-invalid', 'E_STRICT'); $res = PHP_Compat::loadConstant($comps); foreach ($res as $value) { echo ($value === false) ? 'false' : 'true', "\n"; } ?> --EXPECT-- false false false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt +++ pear/PHP_Compat/tests/php-compat-loadconstant_simple.phpt --TEST-- PHP_Compat::loadConstant() -- load invalid and valid function --FILE-- <?php require_once ('PHP/Compat.php'); $res = PHP_Compat::loadConstant('invalid'); echo ($res === false) ? 'false' : 'true', "\n"; $res = PHP_Compat::loadConstant('E_STRICT'); echo ($res === false) ? 'false' : 'true'; ?> --EXPECT-- false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt +++ pear/PHP_Compat/tests/php-compat-loadfunction_array.phpt --TEST-- PHP_Compat::loadFunction() -- load an array of functions --FILE-- <?php require_once ('PHP/Compat.php'); $comps = array('invalid', 'also-invalid', 'more-invalid', 'str_split'); $res = PHP_Compat::loadFunction($comps); foreach ($res as $value) { echo ($value === false) ? 'false' : 'true', "\n"; } ?> --EXPECT-- false false false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt +++ pear/PHP_Compat/tests/php-compat-loadfunction_simple.phpt --TEST-- PHP_Compat::loadFunction() -- load invalid and valid function --FILE-- <?php require_once ('PHP/Compat.php'); $res = PHP_Compat::loadFunction('invalid'); echo ($res === false) ? 'false' : 'true', "\n"; $res = PHP_Compat::loadFunction('str_split'); echo ($res === false) ? 'false' : 'true'; ?> --EXPECT-- false true http://cvs.php.net/co.php/pear/PHP_Compat/tests/scandir_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/scandir_simple.phpt +++ pear/PHP_Compat/tests/scandir_simple.phpt --TEST-- PHP_Compat scandir() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('scandir'); // Create a folder and fill it with files mkdir('tmp'); touch('tmp/test1'); touch('tmp/test2'); // Scan it $dir = 'tmp'; $files = scandir($dir); // List the results print_r($files); // Remove the files unlink('tmp/test1'); unlink('tmp/test2'); rmdir('tmp'); ?> --EXPECT-- Array ( [0] => . [1] => .. [2] => test1 [3] => test2 ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/scandir_sort.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/scandir_sort.phpt +++ pear/PHP_Compat/tests/scandir_sort.phpt --TEST-- PHP_Compat scandir() -- with sorting --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('scandir'); // Create a folder and fill it with files mkdir('tmp'); touch('tmp/test1'); touch('tmp/test2'); // Scan it $dir = 'tmp'; $files = scandir($dir, 1); // List the results print_r($files); // Remove the files unlink('tmp/test1'); unlink('tmp/test2'); rmdir('tmp'); ?> --EXPECT-- Array ( [0] => test2 [1] => test1 [2] => .. [3] => . ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_allarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_allarray.phpt +++ pear/PHP_Compat/tests/str-ireplace_allarray.phpt --TEST-- PHP_Compat str_ireplace() -- All params as arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = array('frog', 'gate', 'beer'); $subject = array('A {animal}', 'The {object}', 'My {thing}'); print_r(str_ireplace($search, $replace, $subject)); ?> --EXPECT-- Array ( [0] => A frog [1] => The gate [2] => My beer ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-arr-replace-arr.phpt --TEST-- PHP_Compat str_ireplace() -- Search and Replace as arrays --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); // Simple $search = array('{ANIMAL}', '{OBJECT}'); $replace = array('frog', 'gate'); $subject = 'The {animal} jumped over the {object}'; echo str_ireplace($search, $replace, $subject), "\n"; // More in search $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = array('frog', 'gate'); $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject), "\n"; // More in replace $search = array('{ANIMAL}', '{OBJECT}'); $replace = array('frog', 'gate', 'door'); $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The frog jumped over the gate The frog jumped over the gate and the ... The frog jumped over the gate and the {thing}... http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-arr-replace-str.phpt --TEST-- PHP_Compat str_ireplace() -- Search as array, Replace as string --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = array('{ANIMAL}', '{OBJECT}', '{THING}'); $replace = 'frog'; $subject = 'The {animal} jumped over the {object} and the {thing}...'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The frog jumped over the frog and the frog... http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt +++ pear/PHP_Compat/tests/str-ireplace_search-str-replace-arr.phpt --TEST-- PHP_Compat str_ireplace() -- Search as string, replace as array --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = '{object}'; $replace = array('cat', 'dog', 'tiger'); $subject = 'The dog jumped over the {object}'; // Supress the error, no way of knowing how it'll turn out on the users machine echo @str_ireplace($search, $replace, $subject); ?> --EXPECT-- The dog jumped over the Array http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_simple.phpt +++ pear/PHP_Compat/tests/str-ireplace_simple.phpt --TEST-- PHP_Compat str_ireplace() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); $search = '{object}'; $replace = 'fence'; $subject = 'The dog jumped over the {object}'; echo str_ireplace($search, $replace, $subject); ?> --EXPECT-- The dog jumped over the fence http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt +++ pear/PHP_Compat/tests/str-ireplace_subjectarray.phpt --TEST-- PHP_Compat str_ireplace() -- With the subject as an array --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_ireplace'); // As a full array $search = '{SUBJECT}'; $replace = 'Lady'; $subject = array('A {subject}', 'The {subject}', 'My {subject}'); print_r(str_ireplace($search, $replace, $subject)); // As a single array $search = '{SUBJECT}'; $replace = 'Lady'; $subject = array('The dog jumped over the {object}'); print_r(str_ireplace($search, $replace, $subject)); ?> --EXPECT-- Array ( [0] => A Lady [1] => The Lady [2] => My Lady ) Array ( [0] => The dog jumped over the {object} ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_bigchunk.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_bigchunk.phpt +++ pear/PHP_Compat/tests/str-split_bigchunk.phpt --TEST-- PHP_Compat str_split() -- chunk size bigger than the string --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "abcd"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => abc [1] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_chunksize.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_chunksize.phpt +++ pear/PHP_Compat/tests/str-split_chunksize.phpt --TEST-- PHP_Compat str_split() -- with a chunk size specified --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "Hello Friend"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => Hel [1] => lo [2] => Fri [3] => end ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_lessremainder.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_lessremainder.phpt +++ pear/PHP_Compat/tests/str-split_lessremainder.phpt --TEST-- PHP_Compat str_split() -- string that has a remainder less than the chunk size --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "abcd"; $arr = str_split($str, 3); print_r($arr); ?> --EXPECT-- Array ( [0] => abc [1] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/str-split_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/str-split_simple.phpt +++ pear/PHP_Compat/tests/str-split_simple.phpt --TEST-- PHP_Compat str_split() -- simple usage --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('str_split'); $str = "Hello Friend"; $arr = str_split($str); print_r($arr); ?> --EXPECT-- Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => F [7] => r [8] => i [9] => e [10] => n [11] => d ) http://cvs.php.net/co.php/pear/PHP_Compat/tests/stripos_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/stripos_simple.phpt +++ pear/PHP_Compat/tests/stripos_simple.phpt --TEST-- PHP_Compat stripos() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('stripos'); $haystack = 'Cat Dog Lion Mouse Sheep Wolf Cat Dog'; $needle = 'DOG'; echo stripos($haystack, $needle, 3); ?> --EXPECT-- 4 http://cvs.php.net/co.php/pear/PHP_Compat/tests/strripos_offset.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/strripos_offset.phpt +++ pear/PHP_Compat/tests/strripos_offset.phpt --TEST-- PHP_Compat strripos() -- with an offset --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('strripos'); $haystack = 'Cat Dog Lion Mouse Dog Sheep Wolf Cat Dog'; $needle = 'DOG'; var_dump(strripos($haystack, $needle, 3)); var_dump(strripos($haystack, $needle, 30)); var_dump(strripos($haystack, $needle, 45)); var_dump(strripos($haystack, $needle, -1)); var_dump(strripos($haystack, $needle, -10)); var_dump(strripos($haystack, $needle, -30)); var_dump(strripos($haystack, $needle, -40)); ?> --EXPECT-- int(34) int(34) bool(false) int(34) int(4) int(4) bool(false) http://cvs.php.net/co.php/pear/PHP_Compat/tests/strripos_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/strripos_simple.phpt +++ pear/PHP_Compat/tests/strripos_simple.phpt --TEST-- PHP_Compat strripos() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('strripos'); $haystack = 'Cat Dog Lion Mouse Sheep Wolf Cat Dog'; $needle = 'DOG'; echo strripos($haystack, $needle); ?> --EXPECT-- 34 http://cvs.php.net/co.php/pear/PHP_Compat/tests/vprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/vprintf_simple.phpt +++ pear/PHP_Compat/tests/vprintf_simple.phpt --TEST-- PHP_Compat vprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('vprintf'); $values = array (2, 'car'); $format = "There are %d monkeys in the %s"; vprintf($format, $values); ?> --EXPECT-- There are 2 monkeys in car http://cvs.php.net/co.php/pear/PHP_Compat/tests/vsprintf_simple.phpt?r=1.1&p=1 Index: pear/PHP_Compat/tests/vsprintf_simple.phpt +++ pear/PHP_Compat/tests/vsprintf_simple.phpt --TEST-- PHP_Compat vsprintf() -- simple --FILE-- <?php require_once ('PHP/Compat.php'); PHP_Compat::loadFunction('vsprintf'); $values = array (2, 'car'); $format = "There are %d monkeys in the %s"; vprintf($format, $values); ?> --EXPECT-- There are 2 monkeys in car