diff options
Diffstat (limited to 'ext/spl/tests')
-rwxr-xr-x | ext/spl/tests/.htaccess | 3 | ||||
-rwxr-xr-x | ext/spl/tests/array_iterator.phpt | 138 | ||||
-rwxr-xr-x | ext/spl/tests/array_object.phpt | 88 | ||||
-rwxr-xr-x | ext/spl/tests/sxe_001.phpt | 60 | ||||
-rwxr-xr-x | ext/spl/tests/sxe_002.phpt | 75 | ||||
-rwxr-xr-x | ext/spl/tests/sxe_003.phpt | 77 |
6 files changed, 0 insertions, 441 deletions
diff --git a/ext/spl/tests/.htaccess b/ext/spl/tests/.htaccess deleted file mode 100755 index 5a01a1c16e..0000000000 --- a/ext/spl/tests/.htaccess +++ /dev/null @@ -1,3 +0,0 @@ -<IfModule mod_autoindex.c> - IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t *.php -</IfModule> diff --git a/ext/spl/tests/array_iterator.phpt b/ext/spl/tests/array_iterator.phpt deleted file mode 100755 index ef5a79819d..0000000000 --- a/ext/spl/tests/array_iterator.phpt +++ /dev/null @@ -1,138 +0,0 @@ ---TEST-- -SPL: ArrayIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -echo "==Normal==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject($arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==UseRef==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Modify==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Delete==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - unset($arr[1]); - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Change==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - $arr = NULL; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "Done\n"; -?> ---EXPECTF-- -==Normal== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>0 -2=>2 - 1=>1 -2=>2 - 2=>2 -==UseRef== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>0 -2=>2 - 1=>1 -2=>2 - 2=>2 -==Modify== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==Delete== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d -1=>1 - 0=>0 -1=>1 - 2=>2 - -Notice: ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_iterator.php on line %d -0=>0 - 0=>0 -0=>0 - 2=>2 -2=>2 - 0=>0 -2=>2 - 2=>2 -==Change== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d - -Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d - -Notice: ArrayIterator::next(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d - -Notice: ArrayIterator::hasMore(): Array was modified outside object and is no longer an array in %sarray_iterator.php on line %d -Done diff --git a/ext/spl/tests/array_object.phpt b/ext/spl/tests/array_object.phpt deleted file mode 100755 index 1ba6101036..0000000000 --- a/ext/spl/tests/array_object.phpt +++ /dev/null @@ -1,88 +0,0 @@ ---TEST-- -SPL: ArrayObject ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> ---FILE-- -<?php - -$ar = array(0=>0, 1=>1); -$ar = new ArrayObject($ar); - -var_dump($ar); - -$ar[2] = 2; -var_dump($ar[2]); -var_dump($ar["3"] = 3); - -var_dump(array_merge((array)$ar, array(4=>4, 5=>5))); - -var_dump($ar["a"] = "a"); - -var_dump($ar); -var_dump($ar[0]); -var_dump($ar[6]); -var_dump($ar["b"]); - -unset($ar[1]); -unset($ar["3"]); -unset($ar["a"]); -unset($ar[7]); -unset($ar["c"]); -var_dump($ar); - -echo "Done\n"; -?> ---EXPECTF-- -object(ArrayObject)#1 (2) { - [0]=> - int(0) - [1]=> - int(1) -} -int(2) -int(3) -array(6) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - &int(2) - [3]=> - &int(3) - [4]=> - int(4) - [5]=> - int(5) -} -string(1) "a" -object(ArrayObject)#1 (5) { - [0]=> - int(0) - [1]=> - int(1) - [2]=> - &int(2) - [3]=> - &int(3) - ["a"]=> - &string(1) "a" -} -int(0) - -Notice: Undefined offset: 6 in %sarray_object.php on line %d -NULL - -Notice: Undefined index: b in %sarray_object.php on line %d -NULL - -Notice: Undefined offset: 7 in %sarray_object.php on line %d - -Notice: Undefined index: c in %sarray_object.php on line %d -object(ArrayObject)#1 (2) { - [0]=> - int(0) - [2]=> - &int(2) -} -Done diff --git a/ext/spl/tests/sxe_001.phpt b/ext/spl/tests/sxe_001.phpt deleted file mode 100755 index 88f83f2abe..0000000000 --- a/ext/spl/tests/sxe_001.phpt +++ /dev/null @@ -1,60 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator ---SKIPIF-- -<?php if (!extension_loaded("spl")) print "skip"; ?> -<?php if (!extension_loaded("simplexml")) print "skip SimpleXML not present"; ?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - <elem1 attr1='first'> - <!-- comment --> - <elem2> - <elem3> - <elem4> - <?test processing instruction ?> - </elem4> - </elem3> - </elem2> - </elem1> -</sxe> -EOF; - -$sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); - -print_r($sxe); - -?> -===DONE=== ---EXPECT-- -SimpleXMLIterator Object -( - [elem1] => SimpleXMLIterator Object - ( - [comment] => SimpleXMLIterator Object - ( - ) - - [elem2] => SimpleXMLIterator Object - ( - [elem3] => SimpleXMLIterator Object - ( - [elem4] => SimpleXMLIterator Object - ( - [test] => SimpleXMLIterator Object - ( - ) - - ) - - ) - - ) - - ) - -) -===DONE=== diff --git a/ext/spl/tests/sxe_002.phpt b/ext/spl/tests/sxe_002.phpt deleted file mode 100755 index b230e8cd8d..0000000000 --- a/ext/spl/tests/sxe_002.phpt +++ /dev/null @@ -1,75 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and recursion ---SKIPIF-- -<?php - if (!extension_loaded('simplexml')) print 'skip'; - if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - Plain text. - <elem1 attr1='first'> - Bla bla 1. - <!-- comment --> - <elem2> - Here we have some text data. - <elem3> - And here some more. - <elem4> - Wow once again. - </elem4> - </elem3> - </elem2> - </elem1> - <elem11 attr2='second'> - Bla bla 2. - <elem111> - Foo Bar - </elem111> - </elem11> -</sxe> -EOF; - -$sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); - -foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); -} - -echo "===DUMP===\n"; - -var_dump(get_class($sxe)); -var_dump(trim($sxe->elem1)); - -?> -===DONE=== ---EXPECT-- -string(5) "elem1" -string(17) "SimpleXMLIterator" -string(10) "Bla bla 1." -string(5) "elem2" -string(17) "SimpleXMLIterator" -string(28) "Here we have some text data." -string(5) "elem3" -string(17) "SimpleXMLIterator" -string(19) "And here some more." -string(5) "elem4" -string(17) "SimpleXMLIterator" -string(15) "Wow once again." -string(6) "elem11" -string(17) "SimpleXMLIterator" -string(10) "Bla bla 2." -string(7) "elem111" -string(17) "SimpleXMLIterator" -string(7) "Foo Bar" -===DUMP=== -string(17) "SimpleXMLIterator" -string(10) "Bla bla 1." -===DONE=== diff --git a/ext/spl/tests/sxe_003.phpt b/ext/spl/tests/sxe_003.phpt deleted file mode 100755 index d247896887..0000000000 --- a/ext/spl/tests/sxe_003.phpt +++ /dev/null @@ -1,77 +0,0 @@ ---TEST-- -SPL: SimpleXMLIterator and getChildren() ---SKIPIF-- -<?php - if (!extension_loaded('simplexml')) print 'skip'; - if (!class_exists('RecursiveIteratorIterator')) print 'skip RecursiveIteratorIterator not available'; -?> ---FILE-- -<?php - -$xml =<<<EOF -<?xml version='1.0'?> -<!DOCTYPE sxe SYSTEM "notfound.dtd"> -<sxe id="elem1"> - Plain text. - <elem1 attr1='first'> - Bla bla 1. - <!-- comment --> - <elem2> - Here we have some text data. - <elem3> - And here some more. - <elem4> - Wow once again. - </elem4> - </elem3> - </elem2> - </elem1> - <elem11 attr2='second'> - Bla bla 2. - <elem111> - Foo Bar - </elem111> - </elem11> -</sxe> -EOF; - -$sxe = simplexml_load_string($xml, 'SimpleXMLIterator'); - -foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); -} - -echo "===RESET===\n"; - -for ($sxe->rewind(); $sxe->hasMore(); $sxe->next()) { - var_dump($sxe->hasChildren()); - var_dump(trim($sxe->key())); - var_dump(trim($sxe->current())); - foreach($sxe->getChildren() as $name => $data) { - var_dump($name); - var_dump(get_class($data)); - var_dump(trim($data)); - } -} - -?> -===DONE=== ---EXPECTF-- - -Warning: Invalid argument supplied for foreach() in %ssxe_003.php on line %d -===RESET=== -bool(true) -string(5) "elem1" -string(10) "Bla bla 1." -string(5) "elem2" -string(17) "SimpleXMLIterator" -string(28) "Here we have some text data." -bool(true) -string(6) "elem11" -string(10) "Bla bla 2." -string(7) "elem111" -string(17) "SimpleXMLIterator" -string(7) "Foo Bar" -===DONE=== |