diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-01-07 13:31:53 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-01-07 13:31:53 +0100 |
| commit | 0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch) | |
| tree | 91f01b0d06916c78262404096bfd466b8e95e5b5 /ext/spl/tests | |
| parent | d3a8757891280dc6650ca7eead67830c794b0e7b (diff) | |
| download | php-upstream/5.3.1.tar.gz | |
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'ext/spl/tests')
119 files changed, 3062 insertions, 2404 deletions
diff --git a/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt new file mode 100644 index 000000000..75d8a4132 --- /dev/null +++ b/ext/spl/tests/ArrayObject_unserialize_empty_string.phpt @@ -0,0 +1,16 @@ +--TEST-- +ArrayObject: test that you cannot unserialize a empty string +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- +<?php +$a = new ArrayObject(array()); +$a->unserialize(""); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Empty serialized string cannot be empty' in %s.php:%d +Stack trace: +#0 %s(%d): ArrayObject->unserialize('') +#1 {main} + thrown in %s.php on line %d diff --git a/ext/spl/tests/DirectoryIterator_by_reference.phpt b/ext/spl/tests/DirectoryIterator_by_reference.phpt new file mode 100644 index 000000000..5352a5df1 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_by_reference.phpt @@ -0,0 +1,14 @@ +--TEST-- +DirectoryIterator: test that you cannot use iterator with reference +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- +<?php +$it = new DirectoryIterator("/tmp"); +foreach( $it as &$file ) { + echo $file . "\n"; +} +?> +--EXPECTF-- +Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/DirectoryIterator_empty_constructor.phpt b/ext/spl/tests/DirectoryIterator_empty_constructor.phpt new file mode 100644 index 000000000..da5276ccd --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_empty_constructor.phpt @@ -0,0 +1,15 @@ +--TEST-- +DirectoryIterator: Test empty value to DirectoryIterator constructor +--CREDITS-- +Havard Eide <nucleuz@gmail.com> +#PHPTestFest2009 Norway 2009-06-09 \o/ +--FILE-- +<?php +$it = new DirectoryIterator(""); +?> +--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'Directory name must not be empty.' in %s:%d +Stack trace: +#0 %s(%d): DirectoryIterator->__construct('') +#1 {main} + thrown in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt index f748bb1c9..ed1f473be 100644 --- a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt +++ b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt @@ -1,23 +1,23 @@ ---TEST--
-DirectoryIterator::getBasename() - Basic Test
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
- mkdir($targetDir);
- touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
- $dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);
- while(!$dir->isFile()) {
- $dir->next();
- }
- echo $dir->getBasename('.txt');
-?>
---CLEAN--
-<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
- unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
- rmdir($targetDir);
-?>
---EXPECTF--
-getBasename_test
+--TEST-- +DirectoryIterator::getBasename() - Basic Test +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename'); + mkdir($targetDir); + touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt'); + $dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR); + while(!$dir->isFile()) { + $dir->next(); + } + echo $dir->getBasename('.txt'); +?> +--CLEAN-- +<?php + $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename'); + unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt'); + rmdir($targetDir); +?> +--EXPECTF-- +getBasename_test diff --git a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt index cad30c686..b2df8a55c 100644 --- a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt +++ b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt @@ -1,23 +1,23 @@ ---TEST--
-DirectoryIterator::getBasename() - Pass unexpected array
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
- mkdir($targetDir);
- touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
- $dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR);
- while(!$dir->isFile()) {
- $dir->next();
- }
- echo $dir->getBasename(array());
-?>
---CLEAN--
-<?php
- $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename');
- unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt');
- rmdir($targetDir);
-?>
---EXPECTF--
-Warning: DirectoryIterator::getBasename() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+--TEST-- +DirectoryIterator::getBasename() - Pass unexpected array +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename'); + mkdir($targetDir); + touch($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt'); + $dir = new DirectoryIterator($targetDir.DIRECTORY_SEPARATOR); + while(!$dir->isFile()) { + $dir->next(); + } + echo $dir->getBasename(array()); +?> +--CLEAN-- +<?php + $targetDir = __DIR__.DIRECTORY_SEPARATOR.md5('directoryIterator::getbasename'); + unlink($targetDir.DIRECTORY_SEPARATOR.'getBasename_test.txt'); + rmdir($targetDir); +?> +--EXPECTF-- +Warning: DirectoryIterator::getBasename() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d diff --git a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt new file mode 100644 index 000000000..58387ccce --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt @@ -0,0 +1,30 @@ +--TEST--
+SPL: DirectoryIterator test getGroup
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +shell_exec('mkdir test_dir_ptfi'); +$dir = new DirectoryIterator('test_dir_ptfi'); +$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 4'); + +var_dump($dir->getGroup() == $result); + +?> +--CLEAN-- +<?php +rmdir('test_dir_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/DirectoryIterator_getInode_basic.phpt b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt new file mode 100644 index 000000000..4fd7e8da3 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getInode_basic.phpt @@ -0,0 +1,29 @@ +--TEST--
+SPL: Spl Directory Iterator test getInode
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +mkdir('test_dir_ptfi'); +$dirIterator = new DirectoryIterator('test_dir_ptfi'); +var_dump(decoct($dirIterator->getInode())); + +?> +--CLEAN-- +<?php +rmdir('test_dir_ptfi'); +?>
+--EXPECTF--
+string(%d) "%d" diff --git a/ext/spl/tests/DirectoryIterator_getInode_error.phpt b/ext/spl/tests/DirectoryIterator_getInode_error.phpt new file mode 100644 index 000000000..c3641f9d8 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getInode_error.phpt @@ -0,0 +1,28 @@ +--TEST--
+SPL: Spl File Info test getInode
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +$fileInfo = new SplFileInfo('not_existing'); +var_dump($fileInfo->getInode()); +?> +
+--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getInode(): stat failed for %s' in %s +Stack trace: +#0 %s: SplFileInfo->getInode() +#1 {main} + thrown in %s diff --git a/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt new file mode 100644 index 000000000..e342dcdb6 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt @@ -0,0 +1,29 @@ +--TEST--
+SPL: Spl Directory Iterator test getOwner
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +shell_exec('mkdir test_dir_ptfi'); +$dir = new DirectoryIterator('test_dir_ptfi'); +$result = shell_exec('ls -lnd test_dir_ptfi | cut -d" " -f 3'); +var_dump($dir->getOwner() == $result); + +?> +--CLEAN-- +<?php +rmdir('test_dir_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt index 4891fbedd..36b186d6b 100644 --- a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::bottom() - pass in an unexpected array parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->bottom(array());
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected array parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->bottom(array()); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt index cff9d6a5e..94312a0f6 100644 --- a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::bottom() - pass in an unexpected float parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->bottom(3.14159);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected float parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->bottom(3.14159); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt index e966199d7..651f1e438 100644 --- a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::bottom() - pass in an unexpected integer parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->bottom(45);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected integer parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->bottom(45); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt index 05b6be932..efc6b8ae5 100644 --- a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::bottom() - pass in an unexpected null parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->bottom(null);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->bottom(null); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::bottom() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt b/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt index 77bd11ee5..36c72de19 100644 --- a/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt @@ -1,11 +1,11 @@ ---TEST--
-Create a SplDoublyLinkedList, call count() and pass a SplDoublyLinkedList object as the parameter.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$dll = new SplDoublyLinkedList(2);
-$dll->count(new SplDoublyLinkedList(2));
-?>
---EXPECTF--
+--TEST-- +Create a SplDoublyLinkedList, call count() and pass a SplDoublyLinkedList object as the parameter. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$dll = new SplDoublyLinkedList(2); +$dll->count(new SplDoublyLinkedList(2)); +?> +--EXPECTF-- Warning: SplDoublyLinkedList::count() expects exactly 0 parameters, 1 given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt index 99aaf2691..558504b38 100644 --- a/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt @@ -1,13 +1,13 @@ ---TEST--
-Run current() function on an empty SplDoublyLinkedList.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-var_dump($list->current());
-
-?>
---EXPECT--
+--TEST-- +Run current() function on an empty SplDoublyLinkedList. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +var_dump($list->current()); + +?> +--EXPECT-- NULL
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt index 639e35fe0..36c47fef2 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::offsetGet() with no parameter passed.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplDoublyLinkedList( );
-
-$get = $array->offsetGet();
-
-?>
---EXPECTF--
+--TEST-- +SplDoublyLinkedList::offsetGet() with no parameter passed. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplDoublyLinkedList( ); + +$get = $array->offsetGet(); + +?> +--EXPECTF-- Warning: SplDoublyLinkedList::offsetGet() expects exactly 1 parameter, 0 given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt index 6e3a69aaf..5df4ab59a 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt @@ -1,18 +1,18 @@ ---TEST--
-SplDoublyLinkedList::offsetGet() with 1st parameter passed as array.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplDoublyLinkedList( );
-
-$get = $array->offsetGet( array( 'fail' ) );
-
-?>
---EXPECTF--
-Fatal error: Uncaught exception 'OutOfRangeException' with message 'Offset invalid or out of range' in %s
-Stack trace:
-#0 %s
-#1 {main}
+--TEST-- +SplDoublyLinkedList::offsetGet() with 1st parameter passed as array. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplDoublyLinkedList( ); + +$get = $array->offsetGet( array( 'fail' ) ); + +?> +--EXPECTF-- +Fatal error: Uncaught exception 'OutOfRangeException' with message 'Offset invalid or out of range' in %s +Stack trace: +#0 %s +#1 {main} thrown in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt index d35aaf16f..fcff762e6 100644 --- a/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt @@ -1,18 +1,18 @@ ---TEST--
-SplDoublyLinkedList::offsetGet() with 1st parameter passed as string.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplDoublyLinkedList( );
-
-$get = $array->offsetGet( 'fail' );
-
-?>
---EXPECTF--
-Fatal error: Uncaught exception 'OutOfRangeException' with message 'Offset invalid or out of range' in %s
-Stack trace:
-#0 %s
-#1 {main}
+--TEST-- +SplDoublyLinkedList::offsetGet() with 1st parameter passed as string. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplDoublyLinkedList( ); + +$get = $array->offsetGet( 'fail' ); + +?> +--EXPECTF-- +Fatal error: Uncaught exception 'OutOfRangeException' with message 'Offset invalid or out of range' in %s +Stack trace: +#0 %s +#1 {main} thrown in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt b/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt index 0b80babe1..11ab343db 100644 --- a/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::offsetGet() with no parameter passed.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplDoublyLinkedList( );
-
-$get = $array->pop( 'param' );
-
-?>
---EXPECTF--
+--TEST-- +SplDoublyLinkedList::offsetGet() with no parameter passed. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplDoublyLinkedList( ); + +$get = $array->pop( 'param' ); + +?> +--EXPECTF-- Warning: SplDoublyLinkedList::pop() expects exactly 0 parameters, 1 given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt b/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt index e92121568..9bf7a3200 100644 --- a/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt @@ -1,11 +1,11 @@ ---TEST--
-Create a SplDoublyLinkedList, call setIteratorMode() and pass a SplDoublyLinkedList object as the parameter.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$dll = new SplDoublyLinkedList(2);
-$dll->setIteratorMode(new SplDoublyLinkedList(2));
-?>
---EXPECTF--
+--TEST-- +Create a SplDoublyLinkedList, call setIteratorMode() and pass a SplDoublyLinkedList object as the parameter. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$dll = new SplDoublyLinkedList(2); +$dll->setIteratorMode(new SplDoublyLinkedList(2)); +?> +--EXPECTF-- Warning: SplDoublyLinkedList::setIteratorMode() expects parameter 1 to be long, object given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt index 33d22d755..2e2632d39 100644 --- a/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::top() - pass in an unexpected array
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->top(array());
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected array +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->top(array()); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt index 08394f386..0a481b85a 100644 --- a/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::top() - pass in an unexpected float parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->top(3.14159);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected float parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->top(3.14159); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt index e44097204..72bdbabc3 100644 --- a/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::top() - pass in an unexpected integer parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->top(45);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected integer parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->top(45); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt index 297506e4b..6a9239973 100644 --- a/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplDoublyLinkedList::top() - pass in an unexpected null parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-
-$list = new SplDoublyLinkedList();
-$list->push("top");
-$list->top(null);
-
-?>
---EXPECTF--
-Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php + +$list = new SplDoublyLinkedList(); +$list->push("top"); +$list->top(null); + +?> +--EXPECTF-- +Warning: SplDoublyLinkedList::top() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileInfo_getGroup_basic.phpt b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt new file mode 100644 index 000000000..7b0528d7d --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt @@ -0,0 +1,30 @@ +--TEST--
+SPL: Spl File Info test getGroup
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +touch ('test_file_ptfi'); +$fileInfo = new SplFileInfo('test_file_ptfi'); +$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 4'); +var_dump($fileInfo->getGroup() == $result); + +?> +--CLEAN-- +<?php +unlink('test_file_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/SplFileInfo_getGroup_error.phpt b/ext/spl/tests/SplFileInfo_getGroup_error.phpt new file mode 100644 index 000000000..f0db00d9e --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getGroup_error.phpt @@ -0,0 +1,28 @@ +--TEST--
+SPL: Spl File Info test getGroup
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +$fileInfo = new SplFileInfo('not_existing'); +var_dump($fileInfo->getGroup()); +?> +
+--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getGroup(): stat failed for not_existing' in %s +Stack trace: +#0 %s: SplFileInfo->getGroup() +#1 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/SplFileInfo_getInode_basic.phpt b/ext/spl/tests/SplFileInfo_getInode_basic.phpt new file mode 100644 index 000000000..902cbb31c --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getInode_basic.phpt @@ -0,0 +1,30 @@ +--TEST--
+SPL: Spl File Info test getInode
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +touch ('test_file_ptfi'); +$fileInfo = new SplFileInfo('test_file_ptfi'); +$result = shell_exec('ls -i test_file_ptfi'); +var_dump($fileInfo->getInode() == $result); + +?> +--CLEAN-- +<?php +unlink('test_file_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/SplFileInfo_getInode_error.phpt b/ext/spl/tests/SplFileInfo_getInode_error.phpt new file mode 100644 index 000000000..bf8efae4c --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getInode_error.phpt @@ -0,0 +1,28 @@ +--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +$fileInfo = new SplFileInfo('not_existing'); +var_dump($fileInfo->getInode()); +?> +
+--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getInode(): stat failed for not_existing' in %s +Stack trace: +#0 %s: SplFileInfo->getInode() +#1 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/SplFileInfo_getOwner_basic.phpt b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt new file mode 100644 index 000000000..50f79430c --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt @@ -0,0 +1,30 @@ +--TEST--
+SPL: Spl File Info test getOwner
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +touch ('test_file_ptfi'); +$fileInfo = new SplFileInfo('test_file_ptfi'); +$result = shell_exec('ls -ln test_file_ptfi | cut -d" " -f 3'); +var_dump($fileInfo->getOwner() == $result); + +?> +--CLEAN-- +<?php +unlink('test_file_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/SplFileInfo_getOwner_error.phpt b/ext/spl/tests/SplFileInfo_getOwner_error.phpt new file mode 100644 index 000000000..d5d46781c --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getOwner_error.phpt @@ -0,0 +1,28 @@ +--TEST--
+SPL: Spl File Info test getOwner
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +$fileInfo = new SplFileInfo('not_existing'); +var_dump($fileInfo->getOwner()); +?> +
+--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getOwner(): stat failed for not_existing' in %s +Stack trace: +#0 %s: SplFileInfo->getOwner() +#1 {main} + thrown in %s on line %d diff --git a/ext/spl/tests/SplFileInfo_getPerms_basic.phpt b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt new file mode 100644 index 000000000..e9b7beaa9 --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getPerms_basic.phpt @@ -0,0 +1,30 @@ +--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +touch ('test_file_ptfi'); +chmod('test_file_ptfi', 0557); +$fileInfo = new SplFileInfo('test_file_ptfi'); +var_dump($fileInfo->getPerms() == 0100557); + +?> +--CLEAN-- +<?php +unlink('test_file_ptfi'); +?>
+--EXPECTF--
+bool(true) diff --git a/ext/spl/tests/SplFileInfo_getPerms_error.phpt b/ext/spl/tests/SplFileInfo_getPerms_error.phpt new file mode 100644 index 000000000..8e05cdf8d --- /dev/null +++ b/ext/spl/tests/SplFileInfo_getPerms_error.phpt @@ -0,0 +1,28 @@ +--TEST--
+SPL: Spl File Info test getPerms
+--CREDITS--
+Cesare D'Amico <cesare.damico@gruppovolta.it> +Andrea Giorgini <agiorg@gmail.com> +Filippo De Santis <fd@ideato.it> +Daniel Londero <daniel.londero@gmail.com> +Francesco Trucchia <ft@ideato.it> +Jacopo Romei <jacopo@sviluppoagile.it> +#Test Fest Cesena (Italy) on 2009-06-20
+--SKIPIF--
+<?php
+if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
+?>
+--FILE--
+<?php
+ +//file +$fileInfo = new SplFileInfo('not_existing'); +var_dump($fileInfo->getPerms() == 0100557); +?> +
+--EXPECTF-- +Fatal error: Uncaught exception 'RuntimeException' with message 'SplFileInfo::getPerms(): stat failed for %s' in %s +Stack trace: +#0 %s: SplFileInfo->getPerms() +#1 {main} + thrown in %s diff --git a/ext/spl/tests/SplFixedArray__construct_param_array.phpt b/ext/spl/tests/SplFixedArray__construct_param_array.phpt index ca0cc197d..d63d7cca5 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_array.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_array.phpt @@ -1,12 +1,12 @@ ---TEST--
-SplFixedArray::__construct() with array passed as integer.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( array("string", 1) );
-
-?>
---EXPECTF--
+--TEST-- +SplFixedArray::__construct() with array passed as integer. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( array("string", 1) ); + +?> +--EXPECTF-- Warning: SplFixedArray::__construct() expects parameter 1 to be long, array given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray__construct_param_float.phpt b/ext/spl/tests/SplFixedArray__construct_param_float.phpt index 833738699..670a1095e 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_float.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_float.phpt @@ -1,14 +1,14 @@ ---TEST--
-SplFixedArray::__construct() with float passed as parameter.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 3.141 );
-
-echo $array->getSize();
-
-?>
---EXPECT--
+--TEST-- +SplFixedArray::__construct() with float passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 3.141 ); + +echo $array->getSize(); + +?> +--EXPECT-- 3
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray__construct_param_null.phpt b/ext/spl/tests/SplFixedArray__construct_param_null.phpt index 2b631c537..3b1543d4d 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_null.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_null.phpt @@ -1,16 +1,16 @@ ---TEST--
-SplFixedArray::__construct() with null passed as parameter.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( NULL );
-
-print_r( $array );
-
-?>
---EXPECTF--
-SplFixedArray Object
-(
+--TEST-- +SplFixedArray::__construct() with null passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( NULL ); + +print_r( $array ); + +?> +--EXPECTF-- +SplFixedArray Object +( )
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray__construct_param_string.phpt b/ext/spl/tests/SplFixedArray__construct_param_string.phpt index 56a2dd809..3a7e734b0 100644 --- a/ext/spl/tests/SplFixedArray__construct_param_string.phpt +++ b/ext/spl/tests/SplFixedArray__construct_param_string.phpt @@ -1,12 +1,12 @@ ---TEST--
-SplFixedArray::__construct() with string passed as parameter.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( "string" );
-
-?>
---EXPECTF--
-Warning: SplFixedArray::__construct() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d
+--TEST-- +SplFixedArray::__construct() with string passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( "string" ); + +?> +--EXPECTF-- +Warning: SplFixedArray::__construct() expects parameter 1 to be long, %unicode_string_optional% given in %s on line %d diff --git a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt index ae0f9e998..6582f847b 100644 --- a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt +++ b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt @@ -1,13 +1,13 @@ ---TEST--
-Create an SplFixedArray using an SplFixedArray object.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = new SplFixedArray(new SplFixedArray(3));
-var_dump($array);
-?>
---EXPECTF--
-Warning: SplFixedArray::__construct() expects parameter 1 to be long, object given in %s on line %d
-object(SplFixedArray)#1 (0) {
+--TEST-- +Create an SplFixedArray using an SplFixedArray object. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = new SplFixedArray(new SplFixedArray(3)); +var_dump($array); +?> +--EXPECTF-- +Warning: SplFixedArray::__construct() expects parameter 1 to be long, object given in %s on line %d +object(SplFixedArray)#1 (0) { }
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray_count_param_int.phpt b/ext/spl/tests/SplFixedArray_count_param_int.phpt index db379906a..108bb2db6 100644 --- a/ext/spl/tests/SplFixedArray_count_param_int.phpt +++ b/ext/spl/tests/SplFixedArray_count_param_int.phpt @@ -1,11 +1,11 @@ ---TEST--
-Creates array, uses the count function to get the size of the array, but passes a parameter.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = new SplFixedArray(5);
-echo $array->count(3);
-?>
---EXPECTF--
+--TEST-- +Creates array, uses the count function to get the size of the array, but passes a parameter. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = new SplFixedArray(5); +echo $array->count(3); +?> +--EXPECTF-- Warning: SplFixedArray::count() expects exactly 0 parameters, 1 given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray_current_param.phpt b/ext/spl/tests/SplFixedArray_current_param.phpt index 46df10d73..71f5d3a52 100644 --- a/ext/spl/tests/SplFixedArray_current_param.phpt +++ b/ext/spl/tests/SplFixedArray_current_param.phpt @@ -1,24 +1,24 @@ ---TEST--
-SplFixedArray::current() with a parameter. *BUG*
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 3 );
-
-$array[0] = "Hello";
-$array[1] = "world";
-$array[2] = "elePHPant";
-
-foreach ( $array as $value ) {
- echo $array->current( array("this","should","not","execute") );
-}
-
-?>
---EXPECTF--
-Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplFixedArray::current() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 3 ); + +$array[0] = "Hello"; +$array[1] = "world"; +$array[2] = "elePHPant"; + +foreach ( $array as $value ) { + echo $array->current( array("this","should","not","execute") ); +} + +?> +--EXPECTF-- +Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: SplFixedArray::current() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt index faac20f03..034d45731 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt @@ -1,22 +1,22 @@ ---TEST--
-Create a SplFixedArray from an array using the fromArray() function use the default behaviour of preserve the indexes.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = SplFixedArray::fromArray(array(1 => 1,
- 2 => '2',
- 3 => false));
-var_dump($array);
-?>
---EXPECTF--
-object(SplFixedArray)#1 (4) {
- [0]=>
- NULL
- [1]=>
- int(1)
- [2]=>
- %string|unicode%(1) "2"
- [3]=>
- bool(false)
-}
+--TEST-- +Create a SplFixedArray from an array using the fromArray() function use the default behaviour of preserve the indexes. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = SplFixedArray::fromArray(array(1 => 1, + 2 => '2', + 3 => false)); +var_dump($array); +?> +--EXPECTF-- +object(SplFixedArray)#1 (4) { + [0]=> + NULL + [1]=> + int(1) + [2]=> + %string|unicode%(1) "2" + [3]=> + bool(false) +} diff --git a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt index a78293bc5..ecae2ab76 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt @@ -1,21 +1,21 @@ ---TEST--
-Create a SplFixedArray from an array using the fromArray() function don't try to preserve the indexes.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = SplFixedArray::fromArray(array(1 => 1,
- 2 => '2',
- 3 => false),
- false);
-var_dump($array);
-?>
---EXPECTF--
-object(SplFixedArray)#1 (3) {
- [0]=>
- int(1)
- [1]=>
- %string|unicode%(1) "2"
- [2]=>
- bool(false)
-}
+--TEST-- +Create a SplFixedArray from an array using the fromArray() function don't try to preserve the indexes. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = SplFixedArray::fromArray(array(1 => 1, + 2 => '2', + 3 => false), + false); +var_dump($array); +?> +--EXPECTF-- +object(SplFixedArray)#1 (3) { + [0]=> + int(1) + [1]=> + %string|unicode%(1) "2" + [2]=> + bool(false) +} diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt index 36a4ab1eb..80d966997 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt @@ -1,10 +1,10 @@ ---TEST--
-Tries to create a SplFixedArray using a boolean value.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = SplFixedArray::fromArray(true);
-?>
---EXPECTF--
+--TEST-- +Tries to create a SplFixedArray using a boolean value. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = SplFixedArray::fromArray(true); +?> +--EXPECTF-- Warning: SplFixedArray::fromArray() expects parameter 1 to be array, boolean given in %s on line %d
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt index 226b38bda..f57fe78fb 100644 --- a/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt +++ b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt @@ -1,17 +1,17 @@ ---TEST--
-Tries to create a SplFixedArray using the fromArray() function and a multi dimentional array.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = SplFixedArray::fromArray(array(array('1')));
-var_dump($array);
-?>
---EXPECTF--
-object(SplFixedArray)#1 (1) {
- [0]=>
- array(1) {
- [0]=>
- %string|unicode%(1) "1"
- }
-}
+--TEST-- +Tries to create a SplFixedArray using the fromArray() function and a multi dimentional array. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = SplFixedArray::fromArray(array(array('1'))); +var_dump($array); +?> +--EXPECTF-- +object(SplFixedArray)#1 (1) { + [0]=> + array(1) { + [0]=> + %string|unicode%(1) "1" + } +} diff --git a/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt b/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt index d60c4bd8f..ef4f40c32 100644 --- a/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt +++ b/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt @@ -1,12 +1,12 @@ ---TEST--
-SplFixedArray::getSize() pass a parameter when none are expected
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-$fixed_array = new SplFixedArray(2);
-echo "*test* ".$fixed_array->getSize(3);
-?>
---EXPECTF--
-Warning: SplFixedArray::getSize() expects exactly 0 parameters, 1 given in %s on line %d
-*test*
+--TEST-- +SplFixedArray::getSize() pass a parameter when none are expected +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php +$fixed_array = new SplFixedArray(2); +echo "*test* ".$fixed_array->getSize(3); +?> +--EXPECTF-- +Warning: SplFixedArray::getSize() expects exactly 0 parameters, 1 given in %s on line %d +*test* diff --git a/ext/spl/tests/SplFixedArray_key_param.phpt b/ext/spl/tests/SplFixedArray_key_param.phpt index a0b24058f..300e6df79 100644 --- a/ext/spl/tests/SplFixedArray_key_param.phpt +++ b/ext/spl/tests/SplFixedArray_key_param.phpt @@ -1,24 +1,24 @@ ---TEST--
-SplFixedArray::key() with a parameter passed. This is a bug and an error should be called.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 3 );
-
-$array[0] = "Hello";
-$array[1] = "world";
-$array[2] = "elePHPant";
-
-foreach ( $array as $value ) {
- echo $array->key( array("this","should","not","execute") );
-}
-
-?>
---EXPECTF--
-Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d
-
-Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplFixedArray::key() with a parameter passed. This is a bug and an error should be called. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 3 ); + +$array[0] = "Hello"; +$array[1] = "world"; +$array[2] = "elePHPant"; + +foreach ( $array as $value ) { + echo $array->key( array("this","should","not","execute") ); +} + +?> +--EXPECTF-- +Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d + +Warning: SplFixedArray::key() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFixedArray_key_setsize.phpt b/ext/spl/tests/SplFixedArray_key_setsize.phpt index 9562a6025..97e48115f 100644 --- a/ext/spl/tests/SplFixedArray_key_setsize.phpt +++ b/ext/spl/tests/SplFixedArray_key_setsize.phpt @@ -1,20 +1,20 @@ ---TEST--
-SplFixedArray::key() when the array has a size higher than the amount of values specified.
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 4 );
-
-$array[0] = "Hello";
-$array[1] = "world";
-$array[2] = "elePHPant";
-
-foreach ( $array as $value ) {
- echo $array->key( );
-}
-
-?>
---EXPECT--
+--TEST-- +SplFixedArray::key() when the array has a size higher than the amount of values specified. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 4 ); + +$array[0] = "Hello"; +$array[1] = "world"; +$array[2] = "elePHPant"; + +foreach ( $array as $value ) { + echo $array->key( ); +} + +?> +--EXPECT-- 0123
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray_next_param.phpt b/ext/spl/tests/SplFixedArray_next_param.phpt index f7a40c107..5e8cb633b 100644 --- a/ext/spl/tests/SplFixedArray_next_param.phpt +++ b/ext/spl/tests/SplFixedArray_next_param.phpt @@ -1,18 +1,18 @@ ---TEST--
-SplFixedArray::next() with a parameter. *BUG*
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 4 );
-
-$array[0] = "Hello";
-$array[1] = "world";
-$array[2] = "elePHPant";
-
-$array->next( "invalid" );
-
-?>
---EXPECTF--
-Warning: SplFixedArray::next() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplFixedArray::next() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 4 ); + +$array[0] = "Hello"; +$array[1] = "world"; +$array[2] = "elePHPant"; + +$array->next( "invalid" ); + +?> +--EXPECTF-- +Warning: SplFixedArray::next() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFixedArray_rewind_param.phpt b/ext/spl/tests/SplFixedArray_rewind_param.phpt index 5d1721946..7002efb31 100644 --- a/ext/spl/tests/SplFixedArray_rewind_param.phpt +++ b/ext/spl/tests/SplFixedArray_rewind_param.phpt @@ -1,18 +1,18 @@ ---TEST--
-SplFixedArray::rewind() with a parameter. *BUG*
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-$array = new SplFixedArray( 4 );
-
-$array[0] = "Hello";
-$array[1] = "world";
-$array[2] = "elePHPant";
-
-$array->rewind( "invalid" );
-
-?>
---EXPECTF--
-Warning: SplFixedArray::rewind() expects exactly 0 parameters, 1 given in %s on line %d
+--TEST-- +SplFixedArray::rewind() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +$array = new SplFixedArray( 4 ); + +$array[0] = "Hello"; +$array[1] = "world"; +$array[2] = "elePHPant"; + +$array->rewind( "invalid" ); + +?> +--EXPECTF-- +Warning: SplFixedArray::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt b/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt index 46922b838..a46074760 100644 --- a/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt +++ b/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt @@ -1,22 +1,22 @@ ---TEST--
-Create array, fills it with and resizes it to lower value.
---CREDITS--
-Philip Norton philipnorton42@gmail.com
---FILE--
-<?php
-$array = new SplFixedArray(5);
-$array[0] = 1;
-$array[1] = 1;
-$array[2] = 1;
-$array[3] = 1;
-$array[4] = 1;
-$array->setSize(2);
-var_dump($array);
-?>
---EXPECT--
-object(SplFixedArray)#1 (2) {
- [0]=>
- int(1)
- [1]=>
- int(1)
+--TEST-- +Create array, fills it with and resizes it to lower value. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +<?php +$array = new SplFixedArray(5); +$array[0] = 1; +$array[1] = 1; +$array[2] = 1; +$array[3] = 1; +$array[4] = 1; +$array->setSize(2); +var_dump($array); +?> +--EXPECT-- +object(SplFixedArray)#1 (2) { + [0]=> + int(1) + [1]=> + int(1) }
\ No newline at end of file diff --git a/ext/spl/tests/SplFixedArray_setSize_param_array.phpt b/ext/spl/tests/SplFixedArray_setSize_param_array.phpt index 6967e47bd..269a45de1 100644 --- a/ext/spl/tests/SplFixedArray_setSize_param_array.phpt +++ b/ext/spl/tests/SplFixedArray_setSize_param_array.phpt @@ -1,18 +1,18 @@ ---TEST--
-SplFixedArray::setSize() with an array parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-$fixed_array = new SplFixedArray(2);
-$fixed_array->setSize(array());
-var_dump($fixed_array);
-?>
---EXPECTF--
-Warning: SplFixedArray::setSize() expects parameter 1 to be long, array given in %s on line %d
-object(SplFixedArray)#1 (2) {
- [0]=>
- NULL
- [1]=>
- NULL
-}
+--TEST-- +SplFixedArray::setSize() with an array parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php +$fixed_array = new SplFixedArray(2); +$fixed_array->setSize(array()); +var_dump($fixed_array); +?> +--EXPECTF-- +Warning: SplFixedArray::setSize() expects parameter 1 to be long, array given in %s on line %d +object(SplFixedArray)#1 (2) { + [0]=> + NULL + [1]=> + NULL +} diff --git a/ext/spl/tests/SplFixedArray_setSize_param_float.phpt b/ext/spl/tests/SplFixedArray_setSize_param_float.phpt index 2cafa8467..c65686c61 100644 --- a/ext/spl/tests/SplFixedArray_setSize_param_float.phpt +++ b/ext/spl/tests/SplFixedArray_setSize_param_float.phpt @@ -1,19 +1,19 @@ ---TEST--
-SplFixedArray::setSize() with a float param
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-$fixed_array = new SplFixedArray(2);
-$fixed_array->setSize(3.14159);
-var_dump($fixed_array);
-?>
---EXPECTF--
-object(SplFixedArray)#1 (3) {
- [0]=>
- NULL
- [1]=>
- NULL
- [2]=>
- NULL
-}
+--TEST-- +SplFixedArray::setSize() with a float param +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php +$fixed_array = new SplFixedArray(2); +$fixed_array->setSize(3.14159); +var_dump($fixed_array); +?> +--EXPECTF-- +object(SplFixedArray)#1 (3) { + [0]=> + NULL + [1]=> + NULL + [2]=> + NULL +} diff --git a/ext/spl/tests/SplFixedArray_setSize_param_null.phpt b/ext/spl/tests/SplFixedArray_setSize_param_null.phpt index d2dec401d..ddb37be9f 100644 --- a/ext/spl/tests/SplFixedArray_setSize_param_null.phpt +++ b/ext/spl/tests/SplFixedArray_setSize_param_null.phpt @@ -1,13 +1,13 @@ ---TEST--
-SplFixedArray::setSize() with a null parameter
---CREDITS--
-PHPNW Testfest 2009 - Adrian Hardy
---FILE--
-<?php
-$fixed_array = new SplFixedArray(2);
-$fixed_array->setSize(null);
-var_dump($fixed_array);
-?>
---EXPECT--
-object(SplFixedArray)#1 (0) {
-}
+--TEST-- +SplFixedArray::setSize() with a null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +<?php +$fixed_array = new SplFixedArray(2); +$fixed_array->setSize(null); +var_dump($fixed_array); +?> +--EXPECT-- +object(SplFixedArray)#1 (0) { +} diff --git a/ext/spl/tests/SplFixedArray_setsize_grow.phpt b/ext/spl/tests/SplFixedArray_setsize_grow.phpt index 0c9f6d83e..418d1ac37 100644 --- a/ext/spl/tests/SplFixedArray_setsize_grow.phpt +++ b/ext/spl/tests/SplFixedArray_setsize_grow.phpt @@ -1,30 +1,30 @@ ---TEST--
-SplFixedArray::setSize() grow
---CREDITS--
-PHPNW Test Fest 2009 - Jordan Hatch
---FILE--
-<?php
-
-echo "\n";
-
-$array = new SplFixedArray(2);
-
-$array[0] = "Value 1";
-$array[1] = "Value 2";
-
-$array->setSize(4);
-
-$array[2] = "Value 3";
-$array[3] = "Value 4";
-
-print_r($array);
-
-?>
---EXPECT--
-SplFixedArray Object
-(
- [0] => Value 1
- [1] => Value 2
- [2] => Value 3
- [3] => Value 4
+--TEST-- +SplFixedArray::setSize() grow +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +<?php + +echo "\n"; + +$array = new SplFixedArray(2); + +$array[0] = "Value 1"; +$array[1] = "Value 2"; + +$array->setSize(4); + +$array[2] = "Value 3"; +$array[3] = "Value 4"; + +print_r($array); + +?> +--EXPECT-- +SplFixedArray Object +( + [0] => Value 1 + [1] => Value 2 + [2] => Value 3 + [3] => Value 4 )
\ No newline at end of file diff --git a/ext/spl/tests/SplObjectStorage_var_dump.phpt b/ext/spl/tests/SplObjectStorage_var_dump.phpt new file mode 100644 index 000000000..c1c7158ec --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_var_dump.phpt @@ -0,0 +1,35 @@ +--TEST-- +SPL: SplObjectStorage: recursive var_dump +--FILE-- +<?php +$o = new SplObjectStorage(); + +$o[new StdClass] = $o; + +var_dump($o); +--EXPECTF-- +object(SplObjectStorage)#1 (1) { + ["storage":"SplObjectStorage":private]=> + array(1) { + ["%s"]=> + array(2) { + ["obj"]=> + object(stdClass)#2 (0) { + } + ["inf"]=> + object(SplObjectStorage)#1 (1) { + ["storage":"SplObjectStorage":private]=> + array(1) { + ["%s"]=> + array(2) { + ["obj"]=> + object(stdClass)#2 (0) { + } + ["inf"]=> + *RECURSION* + } + } + } + } + } +} diff --git a/ext/spl/tests/arrayObject___construct_basic1.phpt b/ext/spl/tests/arrayObject___construct_basic1.phpt index 2134caaab..f192ccab4 100644 --- a/ext/spl/tests/arrayObject___construct_basic1.phpt +++ b/ext/spl/tests/arrayObject___construct_basic1.phpt @@ -1,22 +1,22 @@ ---TEST--
-SPL: ArrayObject::__construct basic usage.
---FILE--
-<?php
-echo "--> No arguments:\n";
-var_dump(new ArrayObject());
-
-echo "--> Object argument:\n";
-$a = new stdClass;
-$a->p = 'hello';
-var_dump(new ArrayObject($a));
-
-echo "--> Array argument:\n";
-var_dump(new ArrayObject(array('key1' => 'val1')));
-
-echo "--> Nested ArrayObject argument:\n";
-var_dump(new ArrayObject(new ArrayObject($a)));
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct basic usage. +--FILE-- +<?php +echo "--> No arguments:\n"; +var_dump(new ArrayObject()); + +echo "--> Object argument:\n"; +$a = new stdClass; +$a->p = 'hello'; +var_dump(new ArrayObject($a)); + +echo "--> Array argument:\n"; +var_dump(new ArrayObject(array('key1' => 'val1'))); + +echo "--> Nested ArrayObject argument:\n"; +var_dump(new ArrayObject(new ArrayObject($a))); +?> +--EXPECTF-- --> No arguments: object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> diff --git a/ext/spl/tests/arrayObject___construct_basic2.phpt b/ext/spl/tests/arrayObject___construct_basic2.phpt index e5200b32f..9ff0e4257 100644 --- a/ext/spl/tests/arrayObject___construct_basic2.phpt +++ b/ext/spl/tests/arrayObject___construct_basic2.phpt @@ -1,52 +1,52 @@ ---TEST--
-SPL: ArrayObject::__construct basic usage.
---FILE--
-<?php
-class C {
- public $prop = 'C::prop.orig';
-}
-
-class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
-}
-
-echo "--> Access prop on instance of ArrayObject:\n";
-$c = new C;
-$ao = new ArrayObject($c);
-testAccess($c, $ao);
-
-echo "\n--> Access prop on instance of MyArrayObject:\n";
-$c = new C;
-$ao = new MyArrayObject($c);
-testAccess($c, $ao);
-
-function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
-
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
-
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
-
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
-
- echo " - After:\n";
- var_dump($ao, $c);
-}
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct basic usage. +--FILE-- +<?php +class C { + public $prop = 'C::prop.orig'; +} + +class MyArrayObject extends ArrayObject { + public $prop = 'MyArrayObject::prop.orig'; +} + +echo "--> Access prop on instance of ArrayObject:\n"; +$c = new C; +$ao = new ArrayObject($c); +testAccess($c, $ao); + +echo "\n--> Access prop on instance of MyArrayObject:\n"; +$c = new C; +$ao = new MyArrayObject($c); +testAccess($c, $ao); + +function testAccess($c, $ao) { + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } + + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); + + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); + + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); + + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); + + echo " - After:\n"; + var_dump($ao, $c); +} +?> +--EXPECTF-- --> Access prop on instance of ArrayObject: - Iteration: prop=>C::prop.orig diff --git a/ext/spl/tests/arrayObject___construct_basic3.phpt b/ext/spl/tests/arrayObject___construct_basic3.phpt index 791681756..1abd1a1ab 100644 --- a/ext/spl/tests/arrayObject___construct_basic3.phpt +++ b/ext/spl/tests/arrayObject___construct_basic3.phpt @@ -1,52 +1,52 @@ ---TEST--
-SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST.
---FILE--
-<?php
-class C {
- public $prop = 'C::prop.orig';
-}
-
-class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
-}
-
-echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:\n";
-$c = new C;
-$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST);
-testAccess($c, $ao);
-
-echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST:\n";
-$c = new C;
-$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST);
-testAccess($c, $ao);
-
-function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
-
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
-
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
-
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
-
- echo " - After:\n";
- var_dump($ao, $c);
-}
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST. +--FILE-- +<?php +class C { + public $prop = 'C::prop.orig'; +} + +class MyArrayObject extends ArrayObject { + public $prop = 'MyArrayObject::prop.orig'; +} + +echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST:\n"; +$c = new C; +$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST); +testAccess($c, $ao); + +echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST:\n"; +$c = new C; +$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST); +testAccess($c, $ao); + +function testAccess($c, $ao) { + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } + + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); + + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); + + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); + + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); + + echo " - After:\n"; + var_dump($ao, $c); +} +?> +--EXPECTF-- --> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST: - Iteration: prop=>C::prop.orig diff --git a/ext/spl/tests/arrayObject___construct_basic4.phpt b/ext/spl/tests/arrayObject___construct_basic4.phpt index ec524712a..80f5e0861 100644 --- a/ext/spl/tests/arrayObject___construct_basic4.phpt +++ b/ext/spl/tests/arrayObject___construct_basic4.phpt @@ -1,52 +1,52 @@ ---TEST--
-SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622.
---FILE--
-<?php
-class C {
- public $prop = 'C::prop.orig';
-}
-
-class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
-}
-
-echo "\n--> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:\n";
-$c = new C;
-$ao = new ArrayObject($c, ArrayObject::ARRAY_AS_PROPS);
-testAccess($c, $ao);
-
-echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::ARRAY_AS_PROPS:\n";
-$c = new C;
-$ao = new MyArrayObject($c, ArrayObject::ARRAY_AS_PROPS);
-testAccess($c, $ao);
-
-function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
-
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
-
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
-
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
-
- echo " - After:\n";
- var_dump($ao, $c);
-}
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct basic usage with ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622. +--FILE-- +<?php +class C { + public $prop = 'C::prop.orig'; +} + +class MyArrayObject extends ArrayObject { + public $prop = 'MyArrayObject::prop.orig'; +} + +echo "\n--> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS:\n"; +$c = new C; +$ao = new ArrayObject($c, ArrayObject::ARRAY_AS_PROPS); +testAccess($c, $ao); + +echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::ARRAY_AS_PROPS:\n"; +$c = new C; +$ao = new MyArrayObject($c, ArrayObject::ARRAY_AS_PROPS); +testAccess($c, $ao); + +function testAccess($c, $ao) { + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } + + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); + + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); + + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); + + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); + + echo " - After:\n"; + var_dump($ao, $c); +} +?> +--EXPECTF-- --> Access prop on instance of ArrayObject with ArrayObject::ARRAY_AS_PROPS: - Iteration: prop=>C::prop.orig diff --git a/ext/spl/tests/arrayObject___construct_basic5.phpt b/ext/spl/tests/arrayObject___construct_basic5.phpt index db4d6abd9..5368d250a 100644 --- a/ext/spl/tests/arrayObject___construct_basic5.phpt +++ b/ext/spl/tests/arrayObject___construct_basic5.phpt @@ -1,52 +1,52 @@ ---TEST--
-SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622.
---FILE--
-<?php
-class C {
- public $prop = 'C::prop.orig';
-}
-
-class MyArrayObject extends ArrayObject {
- public $prop = 'MyArrayObject::prop.orig';
-}
-
-echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
-$c = new C;
-$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-testAccess($c, $ao);
-
-echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n";
-$c = new C;
-$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-testAccess($c, $ao);
-
-function testAccess($c, $ao) {
- echo " - Iteration:\n";
- foreach ($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-
- echo " - Read:\n";
- @var_dump($ao->prop, $ao['prop']);
-
- echo " - Write:\n";
- $ao->prop = 'changed1';
- $ao['prop'] = 'changed2';
- var_dump($ao->prop, $ao['prop']);
-
- echo " - Isset:\n";
- var_dump(isset($ao->prop), isset($ao['prop']));
-
- echo " - Unset:\n";
- unset($ao->prop);
- unset($ao['prop']);
- var_dump($ao->prop, $ao['prop']);
-
- echo " - After:\n";
- var_dump($ao, $c);
-}
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct basic usage with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622. +--FILE-- +<?php +class C { + public $prop = 'C::prop.orig'; +} + +class MyArrayObject extends ArrayObject { + public $prop = 'MyArrayObject::prop.orig'; +} + +echo "\n--> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n"; +$c = new C; +$ao = new ArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS); +testAccess($c, $ao); + +echo "\n--> Access prop on instance of MyArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS:\n"; +$c = new C; +$ao = new MyArrayObject($c, ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS); +testAccess($c, $ao); + +function testAccess($c, $ao) { + echo " - Iteration:\n"; + foreach ($ao as $key=>$value) { + echo " $key=>$value\n"; + } + + echo " - Read:\n"; + @var_dump($ao->prop, $ao['prop']); + + echo " - Write:\n"; + $ao->prop = 'changed1'; + $ao['prop'] = 'changed2'; + var_dump($ao->prop, $ao['prop']); + + echo " - Isset:\n"; + var_dump(isset($ao->prop), isset($ao['prop'])); + + echo " - Unset:\n"; + unset($ao->prop); + unset($ao['prop']); + var_dump($ao->prop, $ao['prop']); + + echo " - After:\n"; + var_dump($ao, $c); +} +?> +--EXPECTF-- --> Access prop on instance of ArrayObject with ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS: - Iteration: prop=>C::prop.orig diff --git a/ext/spl/tests/arrayObject___construct_basic6.phpt b/ext/spl/tests/arrayObject___construct_basic6.phpt index c57a9fc3f..1c7ec3636 100644 --- a/ext/spl/tests/arrayObject___construct_basic6.phpt +++ b/ext/spl/tests/arrayObject___construct_basic6.phpt @@ -1,27 +1,27 @@ ---TEST--
-SPL: ArrayObject::__construct: check impact of ArrayObject::STD_PROP_LIST on var_dump.
---FILE--
-<?php
-class MyArrayObject extends ArrayObject {
- private $priv1 = 'secret1';
- public $pub1 = 'public1';
-}
-
-$ao = new ArrayObject(array(1,2,3));
-$ao->p = 1;
-var_dump($ao);
-
-$ao = new ArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST);
-$ao->p = 1;
-var_dump($ao);
-
-$ao = new MyArrayObject(array(1,2,3));
-var_dump($ao);
-
-$ao = new MyArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST);
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::__construct: check impact of ArrayObject::STD_PROP_LIST on var_dump. +--FILE-- +<?php +class MyArrayObject extends ArrayObject { + private $priv1 = 'secret1'; + public $pub1 = 'public1'; +} + +$ao = new ArrayObject(array(1,2,3)); +$ao->p = 1; +var_dump($ao); + +$ao = new ArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST); +$ao->p = 1; +var_dump($ao); + +$ao = new MyArrayObject(array(1,2,3)); +var_dump($ao); + +$ao = new MyArrayObject(array(1,2,3), ArrayObject::STD_PROP_LIST); +var_dump($ao); +?> +--EXPECTF-- object(ArrayObject)#1 (2) { ["p"]=> int(1) diff --git a/ext/spl/tests/arrayObject___construct_error1.phpt b/ext/spl/tests/arrayObject___construct_error1.phpt index 07e08ccc7..21c312d2d 100644 --- a/ext/spl/tests/arrayObject___construct_error1.phpt +++ b/ext/spl/tests/arrayObject___construct_error1.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: ArrayObject::__construct with bad iterator.
---FILE--
-<?php
-echo "Bad iterator type:\n";
-$a = new stdClass;
-$a->p = 1;
-try {
- var_dump(new ArrayObject($a, 0, "Exception"));
-} catch (InvalidArgumentException $e) {
- echo $e->getMessage() . "(" . $e->getLine() . ")\n";
-}
-
-echo "Non-existent class:\n";
-try {
- var_dump(new ArrayObject(new stdClass, 0, "nonExistentClassName"));
-} catch (InvalidArgumentException $e) {
- echo $e->getMessage() . "(" . $e->getLine() . ")\n";
-}
-?>
---EXPECTF--
-Bad iterator type:
-ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'Exception' given(6)
-Non-existent class:
+--TEST-- +SPL: ArrayObject::__construct with bad iterator. +--FILE-- +<?php +echo "Bad iterator type:\n"; +$a = new stdClass; +$a->p = 1; +try { + var_dump(new ArrayObject($a, 0, "Exception")); +} catch (InvalidArgumentException $e) { + echo $e->getMessage() . "(" . $e->getLine() . ")\n"; +} + +echo "Non-existent class:\n"; +try { + var_dump(new ArrayObject(new stdClass, 0, "nonExistentClassName")); +} catch (InvalidArgumentException $e) { + echo $e->getMessage() . "(" . $e->getLine() . ")\n"; +} +?> +--EXPECTF-- +Bad iterator type: +ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'Exception' given(6) +Non-existent class: ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClassName' given(13) diff --git a/ext/spl/tests/arrayObject___construct_error2.phpt b/ext/spl/tests/arrayObject___construct_error2.phpt index 80b68d6b8..850a2cb3f 100644 --- a/ext/spl/tests/arrayObject___construct_error2.phpt +++ b/ext/spl/tests/arrayObject___construct_error2.phpt @@ -1,22 +1,22 @@ ---TEST--
-SPL: ArrayObject::__construct with too many arguments.
---FILE--
-<?php
-echo "Too many arguments:\n";
-Class C implements Iterator {
- function current() {}
- function next() {}
- function key() {}
- function valid() {}
- function rewind() {}
-}
-
-try {
- var_dump(new ArrayObject(new stdClass, 0, "C", "extra"));
-} catch (InvalidArgumentException $e) {
- echo $e->getMessage() . "(" . $e->getLine() . ")\n";
-}
-?>
---EXPECTF--
-Too many arguments:
+--TEST-- +SPL: ArrayObject::__construct with too many arguments. +--FILE-- +<?php +echo "Too many arguments:\n"; +Class C implements Iterator { + function current() {} + function next() {} + function key() {} + function valid() {} + function rewind() {} +} + +try { + var_dump(new ArrayObject(new stdClass, 0, "C", "extra")); +} catch (InvalidArgumentException $e) { + echo $e->getMessage() . "(" . $e->getLine() . ")\n"; +} +?> +--EXPECTF-- +Too many arguments: ArrayObject::__construct() expects at most 3 parameters, 4 given(12)
\ No newline at end of file diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt index d85202f02..ec69049a3 100644 --- a/ext/spl/tests/arrayObject_asort_basic1.phpt +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -1,26 +1,26 @@ ---TEST--
-SPL: Test ArrayObject::asort() function : basic functionality with array based store
---FILE--
-<?php
-/* Prototype : int ArrayObject::asort()
- * Description: proto int ArrayIterator::asort()
- * Sort the entries by values.
- * Source code: ext/spl/spl_array.c
- * Alias to functions:
- */
-
-echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
-
-$ao1 = new ArrayObject(array(4,2,3));
-$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3));
-var_dump($ao1->asort());
-var_dump($ao1);
-var_dump($ao2->asort('blah'));
-var_dump($ao2);
-?>
-===DONE===
---EXPECTF--
-*** Testing ArrayObject::asort() : basic functionality ***
+--TEST-- +SPL: Test ArrayObject::asort() function : basic functionality with array based store +--FILE-- +<?php +/* Prototype : int ArrayObject::asort() + * Description: proto int ArrayIterator::asort() + * Sort the entries by values. + * Source code: ext/spl/spl_array.c + * Alias to functions: + */ + +echo "*** Testing ArrayObject::asort() : basic functionality ***\n"; + +$ao1 = new ArrayObject(array(4,2,3)); +$ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3)); +var_dump($ao1->asort()); +var_dump($ao1); +var_dump($ao2->asort('blah')); +var_dump($ao2); +?> +===DONE=== +--EXPECTF-- +*** Testing ArrayObject::asort() : basic functionality *** bool(true) object(ArrayObject)#1 (1) { ["storage":"ArrayObject":private]=> diff --git a/ext/spl/tests/arrayObject_asort_basic2.phpt b/ext/spl/tests/arrayObject_asort_basic2.phpt index 5f25fa7dd..d481d0c4e 100644 --- a/ext/spl/tests/arrayObject_asort_basic2.phpt +++ b/ext/spl/tests/arrayObject_asort_basic2.phpt @@ -1,30 +1,30 @@ ---TEST--
-SPL: Test ArrayObject::asort() function : basic functionality with object based store
---FILE--
-<?php
-/* Prototype : int ArrayObject::asort()
- * Description: proto int ArrayIterator::asort()
- * Sort the entries by values.
- * Source code: ext/spl/spl_array.c
- * Alias to functions:
- */
-
-echo "*** Testing ArrayObject::asort() : basic functionality ***\n";
-Class C {
- public $prop1 = 'x';
- public $prop2 = 'z';
- private $prop3 = 'a';
- public $prop4 = 'x';
-}
-
-$c = new C;
-$ao1 = new ArrayObject($c);
-var_dump($ao1->asort());
-var_dump($ao1, $c);
-?>
-===DONE===
---EXPECTF--
-*** Testing ArrayObject::asort() : basic functionality ***
+--TEST-- +SPL: Test ArrayObject::asort() function : basic functionality with object based store +--FILE-- +<?php +/* Prototype : int ArrayObject::asort() + * Description: proto int ArrayIterator::asort() + * Sort the entries by values. + * Source code: ext/spl/spl_array.c + * Alias to functions: + */ + +echo "*** Testing ArrayObject::asort() : basic functionality ***\n"; +Class C { + public $prop1 = 'x'; + public $prop2 = 'z'; + private $prop3 = 'a'; + public $prop4 = 'x'; +} + +$c = new C; +$ao1 = new ArrayObject($c); +var_dump($ao1->asort()); +var_dump($ao1, $c); +?> +===DONE=== +--EXPECTF-- +*** Testing ArrayObject::asort() : basic functionality *** bool(true) object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> diff --git a/ext/spl/tests/arrayObject_clone_basic1.phpt b/ext/spl/tests/arrayObject_clone_basic1.phpt index edffecca2..dd4abf3ff 100644 --- a/ext/spl/tests/arrayObject_clone_basic1.phpt +++ b/ext/spl/tests/arrayObject_clone_basic1.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: Cloning an instance of ArrayObject which wraps an array.
---FILE--
-<?php
-$a = array(1,2);
-$aa1 = new ArrayObject($a);
-$a['p1'] = 'new element added to a before clone';
-
-$aa2 = clone $aa1;
-
-$a['p2'] = 'new element added to a after clone';
-$aa1['new.aa1'] = 'new element added to aa1';
-$aa2['new.aa2'] = 'new element added to aa2';
-var_dump($a, $aa1, $aa2);
-?>
---EXPECTF--
+--TEST-- +SPL: Cloning an instance of ArrayObject which wraps an array. +--FILE-- +<?php +$a = array(1,2); +$aa1 = new ArrayObject($a); +$a['p1'] = 'new element added to a before clone'; + +$aa2 = clone $aa1; + +$a['p2'] = 'new element added to a after clone'; +$aa1['new.aa1'] = 'new element added to aa1'; +$aa2['new.aa2'] = 'new element added to aa2'; +var_dump($a, $aa1, $aa2); +?> +--EXPECTF-- array(4) { [0]=> int(1) diff --git a/ext/spl/tests/arrayObject_clone_basic2.phpt b/ext/spl/tests/arrayObject_clone_basic2.phpt index 250b49ccb..932eaed71 100644 --- a/ext/spl/tests/arrayObject_clone_basic2.phpt +++ b/ext/spl/tests/arrayObject_clone_basic2.phpt @@ -1,21 +1,21 @@ ---TEST--
-SPL: Cloning an instance of ArrayObject which wraps an object.
---FILE--
-<?php
-class C { }
-
-$c = new C;
-$ao1 = new ArrayObject($c);
-$c->p1 = 'new prop added to c before clone';
-
-$ao2 = clone $ao1;
-
-$c->p2 = 'new prop added to c after clone';
-$ao1['new.ao1'] = 'new element added to ao1';
-$ao2['new.ao2'] = 'new element added to ao2';
-var_dump($c, $ao1, $ao2);
-?>
---EXPECTF--
+--TEST-- +SPL: Cloning an instance of ArrayObject which wraps an object. +--FILE-- +<?php +class C { } + +$c = new C; +$ao1 = new ArrayObject($c); +$c->p1 = 'new prop added to c before clone'; + +$ao2 = clone $ao1; + +$c->p2 = 'new prop added to c after clone'; +$ao1['new.ao1'] = 'new element added to ao1'; +$ao2['new.ao2'] = 'new element added to ao2'; +var_dump($c, $ao1, $ao2); +?> +--EXPECTF-- object(C)#1 (3) { ["p1"]=> string(32) "new prop added to c before clone" diff --git a/ext/spl/tests/arrayObject_clone_basic3.phpt b/ext/spl/tests/arrayObject_clone_basic3.phpt index d433f70f1..f7ac89442 100644 --- a/ext/spl/tests/arrayObject_clone_basic3.phpt +++ b/ext/spl/tests/arrayObject_clone_basic3.phpt @@ -1,27 +1,27 @@ ---TEST--
-SPL: Cloning nested ArrayObjects.
---FILE--
-<?php
-class C {
- public $p = 'C::p.orig';
-}
-
-$wrappedObject = new C;
-$innerArrayObject = new ArrayObject($wrappedObject);
-
-$outerArrayObject = new ArrayObject($innerArrayObject);
-
-$wrappedObject->dynamic1 = 'new prop added to $wrappedObject before clone';
-$clonedOuterArrayObject = clone $outerArrayObject;
-$wrappedObject->dynamic2 = 'new prop added to $wrappedObject after clone';
-
-$innerArrayObject['new.iAO'] = 'new element added $innerArrayObject';
-$outerArrayObject['new.oAO'] = 'new element added to $outerArrayObject';
-$clonedOuterArrayObject['new.coAO'] = 'new element added to $clonedOuterArrayObject';
-
-var_dump($wrappedObject, $innerArrayObject, $outerArrayObject, $clonedOuterArrayObject);
-?>
---EXPECTF--
+--TEST-- +SPL: Cloning nested ArrayObjects. +--FILE-- +<?php +class C { + public $p = 'C::p.orig'; +} + +$wrappedObject = new C; +$innerArrayObject = new ArrayObject($wrappedObject); + +$outerArrayObject = new ArrayObject($innerArrayObject); + +$wrappedObject->dynamic1 = 'new prop added to $wrappedObject before clone'; +$clonedOuterArrayObject = clone $outerArrayObject; +$wrappedObject->dynamic2 = 'new prop added to $wrappedObject after clone'; + +$innerArrayObject['new.iAO'] = 'new element added $innerArrayObject'; +$outerArrayObject['new.oAO'] = 'new element added to $outerArrayObject'; +$clonedOuterArrayObject['new.coAO'] = 'new element added to $clonedOuterArrayObject'; + +var_dump($wrappedObject, $innerArrayObject, $outerArrayObject, $clonedOuterArrayObject); +?> +--EXPECTF-- object(C)#1 (5) { ["p"]=> string(9) "C::p.orig" diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt index 63686b063..1a3b84d50 100644 --- a/ext/spl/tests/arrayObject_count_basic1.phpt +++ b/ext/spl/tests/arrayObject_count_basic1.phpt @@ -1,80 +1,80 @@ ---TEST--
-SPL: ArrayObject::count() and ArrayIterator::count() basic functionality.
---FILE--
-==ArrayObject==
-<?php
-class C extends ArrayObject {
- function count() {
- return 99;
- }
-}
-
-$c = new C;
-$ao = new ArrayObject;
-
-var_dump(count($c), count($ao));
-
-$c[] = 'a';
-$ao[] = 'a';
-var_dump(count($c), count($ao));
-
-$c[] = 'b';
-$ao[] = 'b';
-var_dump(count($c), count($ao));
-
-unset($c[0]);
-unset($ao[0]);
-var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
-?>
-==ArrayIterator==
-<?php
-class D extends ArrayIterator {
- function count() {
- return 99;
- }
-}
-
-$c = new D;
-$ao = new ArrayIterator;
-
-var_dump(count($c), count($ao));
-
-$c[] = 'a';
-$ao[] = 'a';
-var_dump(count($c), count($ao));
-
-$c[] = 'b';
-$ao[] = 'b';
-var_dump(count($c), count($ao));
-
-unset($c[0]);
-unset($ao[0]);
-var_dump($c->count(), $ao->count());
-
-//Extra args are ignored.
-var_dump($ao->count('blah'));
-?>
---EXPECTF--
-==ArrayObject==
-int(99)
-int(0)
-int(99)
-int(1)
-int(99)
-int(2)
-int(99)
-int(1)
-int(1)
-==ArrayIterator==
-int(99)
-int(0)
-int(99)
-int(1)
-int(99)
-int(2)
-int(99)
-int(1)
+--TEST-- +SPL: ArrayObject::count() and ArrayIterator::count() basic functionality. +--FILE-- +==ArrayObject== +<?php +class C extends ArrayObject { + function count() { + return 99; + } +} + +$c = new C; +$ao = new ArrayObject; + +var_dump(count($c), count($ao)); + +$c[] = 'a'; +$ao[] = 'a'; +var_dump(count($c), count($ao)); + +$c[] = 'b'; +$ao[] = 'b'; +var_dump(count($c), count($ao)); + +unset($c[0]); +unset($ao[0]); +var_dump($c->count(), $ao->count()); + +//Extra args are ignored. +var_dump($ao->count('blah')); +?> +==ArrayIterator== +<?php +class D extends ArrayIterator { + function count() { + return 99; + } +} + +$c = new D; +$ao = new ArrayIterator; + +var_dump(count($c), count($ao)); + +$c[] = 'a'; +$ao[] = 'a'; +var_dump(count($c), count($ao)); + +$c[] = 'b'; +$ao[] = 'b'; +var_dump(count($c), count($ao)); + +unset($c[0]); +unset($ao[0]); +var_dump($c->count(), $ao->count()); + +//Extra args are ignored. +var_dump($ao->count('blah')); +?> +--EXPECTF-- +==ArrayObject== +int(99) +int(0) +int(99) +int(1) +int(99) +int(2) +int(99) +int(1) +int(1) +==ArrayIterator== +int(99) +int(0) +int(99) +int(1) +int(99) +int(2) +int(99) +int(1) int(1)
\ No newline at end of file diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 91a2d45eb..4045b7a94 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -1,55 +1,55 @@ ---TEST--
-SPL: ArrayObject::exchangeArray() basic usage with object as underlying data store.
---FILE--
-<?php
-
-class C {
- public $pub1 = 'public1';
-}
-
-echo "--> exchangeArray() with objects:\n";
-$original = new C;
-$ao = new ArrayObject($original);
-$swapIn = new C;
-try {
- $copy = $ao->exchangeArray($swapIn);
- $copy['addedToCopy'] = 'added To Copy';
-} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
-}
-$swapIn->addedToSwapIn = 'added To Swap-In';
-$original->addedToOriginal = 'added To Original';
-var_dump($ao, $original, $swapIn, $copy);
-
-
-echo "\n\n--> exchangeArray() with no arg:\n";
-unset($original, $ao, $swapIn, $copy);
-$original = new C;
-$ao = new ArrayObject($original);
-try {
- $copy = $ao->exchangeArray();
- $copy['addedToCopy'] = 'added To Copy';
-} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
-}
-$original->addedToOriginal = 'added To Original';
-var_dump($ao, $original, $copy);
-
-echo "\n\n--> exchangeArray() with bad arg type:\n";
-unset($original, $ao, $swapIn, $copy);
-$original = new C;
-$ao = new ArrayObject($original);
-try {
- $copy = $ao->exchangeArray(null);
- $copy['addedToCopy'] = 'added To Copy';
-} catch (Exception $e) {
- echo "Exception:" . $e->getMessage() . "\n";
-}
-$original->addedToOriginal = 'added To Original';
-var_dump($ao, $original, $copy);
-
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::exchangeArray() basic usage with object as underlying data store. +--FILE-- +<?php + +class C { + public $pub1 = 'public1'; +} + +echo "--> exchangeArray() with objects:\n"; +$original = new C; +$ao = new ArrayObject($original); +$swapIn = new C; +try { + $copy = $ao->exchangeArray($swapIn); + $copy['addedToCopy'] = 'added To Copy'; +} catch (Exception $e) { + echo "Exception:" . $e->getMessage() . "\n"; +} +$swapIn->addedToSwapIn = 'added To Swap-In'; +$original->addedToOriginal = 'added To Original'; +var_dump($ao, $original, $swapIn, $copy); + + +echo "\n\n--> exchangeArray() with no arg:\n"; +unset($original, $ao, $swapIn, $copy); +$original = new C; +$ao = new ArrayObject($original); +try { + $copy = $ao->exchangeArray(); + $copy['addedToCopy'] = 'added To Copy'; +} catch (Exception $e) { + echo "Exception:" . $e->getMessage() . "\n"; +} +$original->addedToOriginal = 'added To Original'; +var_dump($ao, $original, $copy); + +echo "\n\n--> exchangeArray() with bad arg type:\n"; +unset($original, $ao, $swapIn, $copy); +$original = new C; +$ao = new ArrayObject($original); +try { + $copy = $ao->exchangeArray(null); + $copy['addedToCopy'] = 'added To Copy'; +} catch (Exception $e) { + echo "Exception:" . $e->getMessage() . "\n"; +} +$original->addedToOriginal = 'added To Original'; +var_dump($ao, $original, $copy); + +?> +--EXPECTF-- --> exchangeArray() with objects: object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> diff --git a/ext/spl/tests/arrayObject_getFlags_basic1.phpt b/ext/spl/tests/arrayObject_getFlags_basic1.phpt index b55e99310..b078c51ab 100644 --- a/ext/spl/tests/arrayObject_getFlags_basic1.phpt +++ b/ext/spl/tests/arrayObject_getFlags_basic1.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: ArrayObject::getFlags() basic usage
---FILE--
-<?php
-$ao = new ArrayObject(new ArrayObject(new stdClass));
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayObject(array(1,2,3)), ArrayObject::STD_PROP_LIST);
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$cao = clone $ao;
-var_dump($cao->getFlags());
-?>
---EXPECTF--
-int(0)
-int(1)
-int(2)
-int(3)
+--TEST-- +SPL: ArrayObject::getFlags() basic usage +--FILE-- +<?php +$ao = new ArrayObject(new ArrayObject(new stdClass)); +var_dump($ao->getFlags()); + +$ao = new ArrayObject(new ArrayObject(array(1,2,3)), ArrayObject::STD_PROP_LIST); +var_dump($ao->getFlags()); + +$ao = new ArrayObject(new ArrayIterator(new ArrayObject()), ArrayObject::ARRAY_AS_PROPS); +var_dump($ao->getFlags()); + +$ao = new ArrayObject(new ArrayObject(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS); +var_dump($ao->getFlags()); + +$cao = clone $ao; +var_dump($cao->getFlags()); +?> +--EXPECTF-- +int(0) +int(1) +int(2) +int(3) int(3)
\ No newline at end of file diff --git a/ext/spl/tests/arrayObject_getFlags_basic2.phpt b/ext/spl/tests/arrayObject_getFlags_basic2.phpt index e171d79a0..f7d56eaf8 100644 --- a/ext/spl/tests/arrayObject_getFlags_basic2.phpt +++ b/ext/spl/tests/arrayObject_getFlags_basic2.phpt @@ -1,24 +1,24 @@ ---TEST--
-SPL: ArrayObject::getFlags() - ensure flags are passed on to nested array objects and iterators.
---FILE--
-<?php
-$ao = new ArrayObject(array(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS);
-var_dump($ao->getFlags());
-
-$ao2 = new ArrayObject($ao);
-var_dump($ao2->getFlags());
-var_dump($ao2->getIterator()->getFlags());
-
-$ai = new ArrayIterator($ao);
-var_dump($ai->getFlags());
-
-$ao2 = new ArrayObject($ao, 0);
-var_dump($ao2->getFlags());
-
-?>
---EXPECTF--
-int(3)
-int(3)
-int(3)
-int(3)
+--TEST-- +SPL: ArrayObject::getFlags() - ensure flags are passed on to nested array objects and iterators. +--FILE-- +<?php +$ao = new ArrayObject(array(), ArrayObject::STD_PROP_LIST|ArrayObject::ARRAY_AS_PROPS); +var_dump($ao->getFlags()); + +$ao2 = new ArrayObject($ao); +var_dump($ao2->getFlags()); +var_dump($ao2->getIterator()->getFlags()); + +$ai = new ArrayIterator($ao); +var_dump($ai->getFlags()); + +$ao2 = new ArrayObject($ao, 0); +var_dump($ao2->getFlags()); + +?> +--EXPECTF-- +int(3) +int(3) +int(3) +int(3) int(0)
\ No newline at end of file diff --git a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt index c65dc867d..b23c19622 100644 --- a/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt +++ b/ext/spl/tests/arrayObject_getIteratorClass_basic1.phpt @@ -1,64 +1,64 @@ ---TEST--
-SPL: ArrayObject::getIteratorClass and ArrayObject::setIteratorClass basic functionality
---FILE--
-<?php
-class MyIterator extends ArrayIterator {
-
- function __construct() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
- function rewind() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- return parent::rewind();
- }
-
- function valid() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- return parent::valid();
- }
-
- function current() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- return parent::current();
- }
-
- function next() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- return parent::next();
- }
-
- function key() {
- $args = func_get_args();
- echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- return parent::key();
- }
-}
-
-$ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "MyIterator");
-
-echo "--> Access using MyIterator:\n";
-var_dump($ao->getIteratorClass());
-var_dump($ao->getIterator());
-foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
-}
-
-echo "\n\n--> Access using ArrayIterator:\n";
-var_dump($ao->setIteratorClass("ArrayIterator"));
-var_dump($ao->getIteratorClass());
-var_dump($ao->getIterator());
-foreach($ao as $key=>$value) {
- echo "$key=>$value\n";
-}
-
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject::getIteratorClass and ArrayObject::setIteratorClass basic functionality +--FILE-- +<?php +class MyIterator extends ArrayIterator { + + function __construct() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + + function rewind() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + return parent::rewind(); + } + + function valid() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + return parent::valid(); + } + + function current() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + return parent::current(); + } + + function next() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + return parent::next(); + } + + function key() { + $args = func_get_args(); + echo " In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + return parent::key(); + } +} + +$ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "MyIterator"); + +echo "--> Access using MyIterator:\n"; +var_dump($ao->getIteratorClass()); +var_dump($ao->getIterator()); +foreach($ao as $key=>$value) { + echo " $key=>$value\n"; +} + +echo "\n\n--> Access using ArrayIterator:\n"; +var_dump($ao->setIteratorClass("ArrayIterator")); +var_dump($ao->getIteratorClass()); +var_dump($ao->getIterator()); +foreach($ao as $key=>$value) { + echo "$key=>$value\n"; +} + +?> +--EXPECTF-- --> Access using MyIterator: string(10) "MyIterator" object(MyIterator)#2 (1) { diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt index 8dda4c098..9c8d1e734 100644 --- a/ext/spl/tests/arrayObject_ksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt @@ -3,7 +3,7 @@ SPL: Test ArrayObject::ksort() function : basic functionality with array based s --FILE-- <?php /* Prototype : int ArrayObject::ksort() - * Description: proto int ArrayIterator::ksort()
+ * Description: proto int ArrayIterator::ksort() * Sort the entries by key. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_ksort_basic2.phpt b/ext/spl/tests/arrayObject_ksort_basic2.phpt index 43f1fedcf..1464e7376 100644 --- a/ext/spl/tests/arrayObject_ksort_basic2.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic2.phpt @@ -3,7 +3,7 @@ SPL: Test ArrayObject::ksort() function : basic functionality with object base s --FILE-- <?php /* Prototype : int ArrayObject::ksort() - * Description: proto int ArrayIterator::ksort()
+ * Description: proto int ArrayIterator::ksort() * Sort the entries by key. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_magicMethods1.phpt b/ext/spl/tests/arrayObject_magicMethods1.phpt index 8d3ff3862..b1de4a951 100644 --- a/ext/spl/tests/arrayObject_magicMethods1.phpt +++ b/ext/spl/tests/arrayObject_magicMethods1.phpt @@ -1,73 +1,73 @@ ---TEST--
-SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using [].
---FILE--
-<?php
-class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-
-$obj = new UsesMagic;
-
-$ao = new ArrayObject($obj);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao['a'] = 'changed';
-$ao['dynamic'] = 'new';
-$ao['dynamic'] = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao['a']);
-var_dump($ao['nonexistent']);
-var_dump($ao['dynamic']);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao['a']));
-var_dump(isset($ao['nonexistent']));
-var_dump(isset($ao['dynamic']));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao['a']);
-unset($ao['nonexistent']);
-unset($ao['dynamic']);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using []. +--FILE-- +<?php +class UsesMagic { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} + +$obj = new UsesMagic; + +$ao = new ArrayObject($obj); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao['a'] = 'changed'; +$ao['dynamic'] = 'new'; +$ao['dynamic'] = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao['a']); +var_dump($ao['nonexistent']); +var_dump($ao['dynamic']); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao['a'])); +var_dump(isset($ao['nonexistent'])); +var_dump(isset($ao['dynamic'])); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao['a']); +unset($ao['nonexistent']); +unset($ao['dynamic']); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> +--EXPECTF-- --> Write existent, non-existent and dynamic: Original wrapped object: object(UsesMagic)#1 (5) { diff --git a/ext/spl/tests/arrayObject_magicMethods2.phpt b/ext/spl/tests/arrayObject_magicMethods2.phpt index 79d972929..691a9a1e6 100644 --- a/ext/spl/tests/arrayObject_magicMethods2.phpt +++ b/ext/spl/tests/arrayObject_magicMethods2.phpt @@ -1,73 +1,73 @@ ---TEST--
-SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using ->.
---FILE--
-<?php
-class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-
-$obj = new UsesMagic;
-
-$ao = new ArrayObject($obj);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao->a = 'changed';
-$ao->dynamic = 'new';
-$ao->dynamic = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao->a);
-var_dump($ao->nonexistent);
-var_dump($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao->a));
-var_dump(isset($ao->nonexistent));
-var_dump(isset($ao->dynamic));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao->a);
-unset($ao->nonexistent);
-unset($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using ->. +--FILE-- +<?php +class UsesMagic { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} + +$obj = new UsesMagic; + +$ao = new ArrayObject($obj); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao->a = 'changed'; +$ao->dynamic = 'new'; +$ao->dynamic = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao->a); +var_dump($ao->nonexistent); +var_dump($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao->a)); +var_dump(isset($ao->nonexistent)); +var_dump(isset($ao->dynamic)); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao->a); +unset($ao->nonexistent); +unset($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> +--EXPECTF-- --> Write existent, non-existent and dynamic: Original wrapped object: object(UsesMagic)#1 (4) { diff --git a/ext/spl/tests/arrayObject_magicMethods3.phpt b/ext/spl/tests/arrayObject_magicMethods3.phpt index 749e9cf28..16a6a3b80 100644 --- a/ext/spl/tests/arrayObject_magicMethods3.phpt +++ b/ext/spl/tests/arrayObject_magicMethods3.phpt @@ -1,72 +1,72 @@ ---TEST--
-SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using -> and ArrayObject::ARRAY_AS_PROPS.
---FILE--
-<?php
-class UsesMagic {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-
-$obj = new UsesMagic;
-
-$ao = new ArrayObject($obj, ArrayObject::ARRAY_AS_PROPS);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao->a = 'changed';
-$ao->dynamic = 'new';
-$ao->dynamic = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao->a);
-var_dump($ao->nonexistent);
-var_dump($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao->a));
-var_dump(isset($ao->nonexistent));
-var_dump(isset($ao->dynamic));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao->a);
-unset($ao->nonexistent);
-unset($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
+--TEST-- +SPL: ArrayObject: ensure a wrapped object's magic methods for property access are not invoked when manipulating the ArrayObject's elements using -> and ArrayObject::ARRAY_AS_PROPS. +--FILE-- +<?php +class UsesMagic { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} + +$obj = new UsesMagic; + +$ao = new ArrayObject($obj, ArrayObject::ARRAY_AS_PROPS); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao->a = 'changed'; +$ao->dynamic = 'new'; +$ao->dynamic = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao->a); +var_dump($ao->nonexistent); +var_dump($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao->a)); +var_dump(isset($ao->nonexistent)); +var_dump(isset($ao->dynamic)); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao->a); +unset($ao->nonexistent); +unset($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> --EXPECTF-- --> Write existent, non-existent and dynamic: Original wrapped object: diff --git a/ext/spl/tests/arrayObject_magicMethods4.phpt b/ext/spl/tests/arrayObject_magicMethods4.phpt index 39c30aa5f..3c9f78781 100644 --- a/ext/spl/tests/arrayObject_magicMethods4.phpt +++ b/ext/spl/tests/arrayObject_magicMethods4.phpt @@ -1,76 +1,76 @@ ---TEST--
-SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject are not invoked when manipulating its elements using [].
---FILE--
-<?php
-class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-}
-
-class UsesMagic extends ArrayObject {
-
- public $b = "This should not be in the storage";
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-$obj = new C;
-$ao = new UsesMagic($obj);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao['a'] = 'changed';
-$ao['dynamic'] = 'new';
-$ao['dynamic'] = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao['a']);
-var_dump($ao['nonexistent']);
-var_dump($ao['dynamic']);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao['a']));
-var_dump(isset($ao['nonexistent']));
-var_dump(isset($ao['dynamic']));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao['a']);
-unset($ao['nonexistent']);
-unset($ao['dynamic']);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject are not invoked when manipulating its elements using []. +--FILE-- +<?php +class C { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; +} + +class UsesMagic extends ArrayObject { + + public $b = "This should not be in the storage"; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} +$obj = new C; +$ao = new UsesMagic($obj); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao['a'] = 'changed'; +$ao['dynamic'] = 'new'; +$ao['dynamic'] = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao['a']); +var_dump($ao['nonexistent']); +var_dump($ao['dynamic']); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao['a'])); +var_dump(isset($ao['nonexistent'])); +var_dump(isset($ao['dynamic'])); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao['a']); +unset($ao['nonexistent']); +unset($ao['dynamic']); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> +--EXPECTF-- --> Write existent, non-existent and dynamic: Original wrapped object: object(C)#1 (5) { diff --git a/ext/spl/tests/arrayObject_magicMethods5.phpt b/ext/spl/tests/arrayObject_magicMethods5.phpt index b59bf7137..023086d83 100644 --- a/ext/spl/tests/arrayObject_magicMethods5.phpt +++ b/ext/spl/tests/arrayObject_magicMethods5.phpt @@ -1,76 +1,76 @@ ---TEST--
-SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject ARE invoked when manipulating its elements using ->.
---FILE--
-<?php
-class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-}
-
-class UsesMagic extends ArrayObject {
-
- public $b = "This should appear in storage";
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-$obj = new C;
-$ao = new UsesMagic($obj);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao->a = 'changed';
-$ao->dynamic = 'new';
-$ao->dynamic = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao->a);
-var_dump($ao->nonexistent);
-var_dump($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao->a));
-var_dump(isset($ao->nonexistent));
-var_dump(isset($ao->dynamic));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao->a);
-unset($ao->nonexistent);
-unset($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject ARE invoked when manipulating its elements using ->. +--FILE-- +<?php +class C { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; +} + +class UsesMagic extends ArrayObject { + + public $b = "This should appear in storage"; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} +$obj = new C; +$ao = new UsesMagic($obj); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao->a = 'changed'; +$ao->dynamic = 'new'; +$ao->dynamic = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao->a); +var_dump($ao->nonexistent); +var_dump($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao->a)); +var_dump(isset($ao->nonexistent)); +var_dump(isset($ao->dynamic)); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao->a); +unset($ao->nonexistent); +unset($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> +--EXPECTF-- --> Write existent, non-existent and dynamic: In UsesMagic::__set(a,changed) In UsesMagic::__set(dynamic,new) diff --git a/ext/spl/tests/arrayObject_magicMethods6.phpt b/ext/spl/tests/arrayObject_magicMethods6.phpt index 90781fa1d..45a0e4a76 100644 --- a/ext/spl/tests/arrayObject_magicMethods6.phpt +++ b/ext/spl/tests/arrayObject_magicMethods6.phpt @@ -1,76 +1,76 @@ ---TEST--
-SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject are not invoked when manipulating its elements using -> ArrayObject::ARRAY_AS_PROPS.
---FILE--
-<?php
-class C {
- public $a = 1;
- public $b = 2;
- public $c = 3;
-
- private $priv = 'secret';
-}
-
-class UsesMagic extends ArrayObject {
-
- public $b = "This should never appear in storage";
-
- function __get($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __set($name, $value) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __isset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
- function __unset($name) {
- $args = func_get_args();
- echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n";
- }
-
-}
-$obj = new C;
-$ao = new UsesMagic($obj, ArrayObject::ARRAY_AS_PROPS);
-echo "\n--> Write existent, non-existent and dynamic:\n";
-$ao->a = 'changed';
-$ao->dynamic = 'new';
-$ao->dynamic = 'new.changed';
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Read existent, non-existent and dynamic:\n";
-var_dump($ao->a);
-var_dump($ao->nonexistent);
-var_dump($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> isset existent, non-existent and dynamic:\n";
-var_dump(isset($ao->a));
-var_dump(isset($ao->nonexistent));
-var_dump(isset($ao->dynamic));
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-
-echo "\n--> Unset existent, non-existent and dynamic:\n";
-unset($ao->a);
-unset($ao->nonexistent);
-unset($ao->dynamic);
-echo " Original wrapped object:\n";
-var_dump($obj);
-echo " Wrapping ArrayObject:\n";
-var_dump($ao);
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject: ensure the magic methods for property access of a subclass of ArrayObject are not invoked when manipulating its elements using -> ArrayObject::ARRAY_AS_PROPS. +--FILE-- +<?php +class C { + public $a = 1; + public $b = 2; + public $c = 3; + + private $priv = 'secret'; +} + +class UsesMagic extends ArrayObject { + + public $b = "This should never appear in storage"; + + function __get($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __set($name, $value) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __isset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + function __unset($name) { + $args = func_get_args(); + echo "In " . __METHOD__ . "(" . implode($args, ',') . ")\n"; + } + +} +$obj = new C; +$ao = new UsesMagic($obj, ArrayObject::ARRAY_AS_PROPS); +echo "\n--> Write existent, non-existent and dynamic:\n"; +$ao->a = 'changed'; +$ao->dynamic = 'new'; +$ao->dynamic = 'new.changed'; +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Read existent, non-existent and dynamic:\n"; +var_dump($ao->a); +var_dump($ao->nonexistent); +var_dump($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> isset existent, non-existent and dynamic:\n"; +var_dump(isset($ao->a)); +var_dump(isset($ao->nonexistent)); +var_dump(isset($ao->dynamic)); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); + +echo "\n--> Unset existent, non-existent and dynamic:\n"; +unset($ao->a); +unset($ao->nonexistent); +unset($ao->dynamic); +echo " Original wrapped object:\n"; +var_dump($obj); +echo " Wrapping ArrayObject:\n"; +var_dump($ao); +?> +--EXPECTF-- --> Write existent, non-existent and dynamic: Original wrapped object: object(C)#1 (5) { diff --git a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt index fed9f316b..62ad2ed48 100644 --- a/ext/spl/tests/arrayObject_natcasesort_basic1.phpt +++ b/ext/spl/tests/arrayObject_natcasesort_basic1.phpt @@ -3,7 +3,7 @@ SPL: Test ArrayObject::natcasesort() function : basic functionality --FILE-- <?php /* Prototype : int ArrayObject::natcasesort() - * Description: proto int ArrayIterator::natcasesort()
+ * Description: proto int ArrayIterator::natcasesort() Sort the entries by values using case insensitive "natural order" algorithm. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_natsort_basic1.phpt b/ext/spl/tests/arrayObject_natsort_basic1.phpt index d4b2b9674..1b4fd60f5 100644 --- a/ext/spl/tests/arrayObject_natsort_basic1.phpt +++ b/ext/spl/tests/arrayObject_natsort_basic1.phpt @@ -3,7 +3,7 @@ SPL: Test ArrayObject::natsort() function : basic functionality --FILE-- <?php /* Prototype : int ArrayObject::natsort() - * Description: proto int ArrayIterator::natsort()
+ * Description: proto int ArrayIterator::natsort() Sort the entries by values using "natural order" algorithm. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_setFlags_basic1.phpt b/ext/spl/tests/arrayObject_setFlags_basic1.phpt index efda9e8ac..d8d4f2e96 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic1.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic1.phpt @@ -1,51 +1,51 @@ ---TEST--
-SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622.
---FILE--
-<?php
-class C extends ArrayObject {
- public $p = 'object property';
-}
-
-function access_p($ao) {
- // isset
- var_dump(isset($ao->p));
- // read
- var_dump($ao->p);
- // write
- $ao->p = $ao->p . '.changed';
- var_dump($ao->p);
-}
-
-$ao = new C(array('p'=>'array element'));
-$ao->setFlags(ArrayObject::ARRAY_AS_PROPS);
-
-echo "\n--> Access the real property:\n";
-access_p($ao);
-
-echo "\n--> Remove the real property and access the array element:\n";
-unset($ao->p);
-access_p($ao);
-
-echo "\n--> Remove the array element and try access again:\n";
-unset($ao->p);
-access_p($ao);
-?>
---EXPECTF--
---> Access the real property:
-bool(true)
-string(15) "object property"
-string(23) "object property.changed"
-
---> Remove the real property and access the array element:
-bool(true)
-string(13) "array element"
-string(21) "array element.changed"
-
---> Remove the array element and try access again:
-bool(false)
-
-Notice: Undefined index: p in %s on line 10
-NULL
-
-Notice: Undefined index: p in %s on line 12
-string(8) ".changed"
+--TEST-- +SPL: ArrayObject::setFlags basic usage with ArrayObject::ARRAY_AS_PROPS. Currently fails on php.net due to bug 45622. +--FILE-- +<?php +class C extends ArrayObject { + public $p = 'object property'; +} + +function access_p($ao) { + // isset + var_dump(isset($ao->p)); + // read + var_dump($ao->p); + // write + $ao->p = $ao->p . '.changed'; + var_dump($ao->p); +} + +$ao = new C(array('p'=>'array element')); +$ao->setFlags(ArrayObject::ARRAY_AS_PROPS); + +echo "\n--> Access the real property:\n"; +access_p($ao); + +echo "\n--> Remove the real property and access the array element:\n"; +unset($ao->p); +access_p($ao); + +echo "\n--> Remove the array element and try access again:\n"; +unset($ao->p); +access_p($ao); +?> +--EXPECTF-- +--> Access the real property: +bool(true) +string(15) "object property" +string(23) "object property.changed" + +--> Remove the real property and access the array element: +bool(true) +string(13) "array element" +string(21) "array element.changed" + +--> Remove the array element and try access again: +bool(false) + +Notice: Undefined index: p in %s on line 10 +NULL + +Notice: Undefined index: p in %s on line 12 +string(8) ".changed" diff --git a/ext/spl/tests/arrayObject_setFlags_basic2.phpt b/ext/spl/tests/arrayObject_setFlags_basic2.phpt index 1af312ab4..806f8129a 100644 --- a/ext/spl/tests/arrayObject_setFlags_basic2.phpt +++ b/ext/spl/tests/arrayObject_setFlags_basic2.phpt @@ -1,29 +1,29 @@ ---TEST--
-SPL: Ensure access to non-visible properties falls back to dimension access with ArrayObject::ARRAY_AS_PROPS.
---FILE--
-<?php
-class C extends ArrayObject {
- private $x = 'secret';
-
- static function go($c) {
- var_dump($c->x);
- }
-}
-
-$c = new C(array('x'=>'public'));
-
-$c->setFlags(ArrayObject::ARRAY_AS_PROPS);
-C::go($c);
-var_dump($c->x);
-
-
-$c->setFlags(0);
-C::go($c);
-var_dump($c->x);
-?>
---EXPECTF--
-string(6) "secret"
-string(6) "public"
-string(6) "secret"
-
-Fatal error: Cannot access private property C::$x in %s on line 19
+--TEST-- +SPL: Ensure access to non-visible properties falls back to dimension access with ArrayObject::ARRAY_AS_PROPS. +--FILE-- +<?php +class C extends ArrayObject { + private $x = 'secret'; + + static function go($c) { + var_dump($c->x); + } +} + +$c = new C(array('x'=>'public')); + +$c->setFlags(ArrayObject::ARRAY_AS_PROPS); +C::go($c); +var_dump($c->x); + + +$c->setFlags(0); +C::go($c); +var_dump($c->x); +?> +--EXPECTF-- +string(6) "secret" +string(6) "public" +string(6) "secret" + +Fatal error: Cannot access private property C::$x in %s on line 19 diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt index 1cba535ce..4715eea98 100644 --- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt +++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt @@ -1,48 +1,48 @@ ---TEST--
-SPL: ArrayObject with bad iterator class.
---FILE--
-<?php
-try {
- $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3));
- $ao->setIteratorClass("nonExistentClass");
- foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-try {
- $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3));
- $ao->setIteratorClass("stdClass");
- foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-
-try {
- $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "nonExistentClass");
- foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-try {
- $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "stdClass");
- foreach($ao as $key=>$value) {
- echo " $key=>$value\n";
- }
-} catch (Exception $e) {
- var_dump($e->getMessage());
-}
-
-?>
---EXPECTF--
+--TEST-- +SPL: ArrayObject with bad iterator class. +--FILE-- +<?php +try { + $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3)); + $ao->setIteratorClass("nonExistentClass"); + foreach($ao as $key=>$value) { + echo " $key=>$value\n"; + } +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +try { + $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3)); + $ao->setIteratorClass("stdClass"); + foreach($ao as $key=>$value) { + echo " $key=>$value\n"; + } +} catch (Exception $e) { + var_dump($e->getMessage()); +} + + +try { + $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "nonExistentClass"); + foreach($ao as $key=>$value) { + echo " $key=>$value\n"; + } +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +try { + $ao = new ArrayObject(array('a'=>1,'b'=>2,'c'=>3), 0, "stdClass"); + foreach($ao as $key=>$value) { + echo " $key=>$value\n"; + } +} catch (Exception $e) { + var_dump($e->getMessage()); +} + +?> +--EXPECTF-- Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4 a=>1 b=>2 diff --git a/ext/spl/tests/arrayObject_uasort_basic1.phpt b/ext/spl/tests/arrayObject_uasort_basic1.phpt index 3cff53cdf..203edb6fb 100644 --- a/ext/spl/tests/arrayObject_uasort_basic1.phpt +++ b/ext/spl/tests/arrayObject_uasort_basic1.phpt @@ -3,7 +3,7 @@ SPL: Test ArrayObject::uasort() function : basic functionality --FILE-- <?php /* Prototype : int ArrayObject::uasort(callback cmp_function) - * Description: proto int ArrayIterator::uasort(callback cmp_function)
+ * Description: proto int ArrayIterator::uasort(callback cmp_function) Sort the entries by values user defined function. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_uasort_error1.phpt b/ext/spl/tests/arrayObject_uasort_error1.phpt index 0a766102b..d7306c9c8 100644 --- a/ext/spl/tests/arrayObject_uasort_error1.phpt +++ b/ext/spl/tests/arrayObject_uasort_error1.phpt @@ -3,7 +3,7 @@ Test ArrayObject::uasort() function : wrong arg count --FILE-- <?php /* Prototype : int ArrayObject::uasort(callback cmp_function) - * Description: proto int ArrayIterator::uasort(callback cmp_function)
+ * Description: proto int ArrayIterator::uasort(callback cmp_function) Sort the entries by values user defined function. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_uksort_basic1.phpt b/ext/spl/tests/arrayObject_uksort_basic1.phpt index fd2d746c1..1581589e4 100644 --- a/ext/spl/tests/arrayObject_uksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_uksort_basic1.phpt @@ -3,7 +3,7 @@ Test ArrayObject::uksort() function : basic functionality --FILE-- <?php /* Prototype : int ArrayObject::uksort(callback cmp_function) - * Description: proto int ArrayIterator::uksort(callback cmp_function)
+ * Description: proto int ArrayIterator::uksort(callback cmp_function) * Sort the entries by key using user defined function. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/arrayObject_uksort_error1.phpt b/ext/spl/tests/arrayObject_uksort_error1.phpt index 56b449af3..d019fc440 100644 --- a/ext/spl/tests/arrayObject_uksort_error1.phpt +++ b/ext/spl/tests/arrayObject_uksort_error1.phpt @@ -3,7 +3,7 @@ Test ArrayObject::uksort() function : wrong arg count --FILE-- <?php /* Prototype : int ArrayObject::uksort(callback cmp_function) - * Description: proto int ArrayIterator::uksort(callback cmp_function)
+ * Description: proto int ArrayIterator::uksort(callback cmp_function) Sort the entries by key using user defined function. * Source code: ext/spl/spl_array.c * Alias to functions: diff --git a/ext/spl/tests/array_027.phpt b/ext/spl/tests/array_027.phpt new file mode 100644 index 000000000..791e76322 --- /dev/null +++ b/ext/spl/tests/array_027.phpt @@ -0,0 +1,24 @@ +--TEST-- +SPL: ArrayObject revursive var_dump +--FILE-- +<?php +class AO extends ArrayObject { +} +$o = new AO(); +$o['plop'] = $o; + +var_dump($o); +--EXPECTF-- +object(AO)#1 (1) { + ["storage":"ArrayObject":private]=> + array(1) { + ["plop"]=> + object(AO)#1 (1) { + ["storage":"ArrayObject":private]=> + array(1) { + ["plop"]=> + *RECURSION* + } + } + } +} diff --git a/ext/spl/tests/bug42364.phpt b/ext/spl/tests/bug42364.phpt index e02a3c5bb..ad0bd8f24 100644 --- a/ext/spl/tests/bug42364.phpt +++ b/ext/spl/tests/bug42364.phpt @@ -17,7 +17,8 @@ foreach ($it as $e) { if ($count > 0) { echo "Found $count entries!\n"; } -echo "===DONE===" +?> +===DONE=== ?> --EXPECTF-- Found %i entries! diff --git a/ext/spl/tests/bug44144.phpt b/ext/spl/tests/bug44144.phpt new file mode 100644 index 000000000..2933d2f22 --- /dev/null +++ b/ext/spl/tests/bug44144.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #44144 (spl_autoload_functions() should return object instance when appropriate) +--SKIPIF-- +<?php if (!extension_loaded("spl")) print "skip"; ?> +--FILE-- +<?php +class Foo { + public function nonstaticMethod() {} +} +$foo = new Foo; +spl_autoload_register(array($foo, 'nonstaticMethod')); +$funcs = spl_autoload_functions(); +var_dump($funcs); +?> +--EXPECTF-- +array(1) { + [0]=> + array(2) { + [0]=> + object(Foo)#%d (0) { + } + [1]=> + string(15) "nonstaticMethod" + } +} + + diff --git a/ext/spl/tests/countable_class_basic1.phpt b/ext/spl/tests/countable_class_basic1.phpt index 7b084f878..c64aad6b6 100644 --- a/ext/spl/tests/countable_class_basic1.phpt +++ b/ext/spl/tests/countable_class_basic1.phpt @@ -1,34 +1,37 @@ ---TEST--
-SPL: Test shape of interface Countable.
---SKIPIF--
-<?php
-// Skip the test case if Standard PHP Library(spl) is not installed
- if( !extension_loaded('spl'))
- {
- die('skip spl is not installed');
- }
-?>
---FILE--
-<?php
-ReflectionClass::export('Countable');
-?>
---EXPECTF--
-Interface [ <internal%s> interface Countable ] {
-
- - Constants [0] {
- }
-
- - Static properties [0] {
- }
-
- - Static methods [0] {
- }
-
- - Properties [0] {
- }
-
- - Methods [1] {
- Method [ <internal%s> abstract public method count ] {
- }
- }
-}
+--TEST-- +SPL: Test shape of interface Countable. +--SKIPIF-- +<?php +// Skip the test case if Standard PHP Library(spl) is not installed + if( !extension_loaded('spl')) + { + die('skip spl is not installed'); + } +?> +--FILE-- +<?php +ReflectionClass::export('Countable'); +?> +--EXPECTF-- +Interface [ <internal%s> interface Countable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <internal%s> abstract public method count ] { + + - Parameters [0] { + } + } + } +} diff --git a/ext/spl/tests/countable_count_variation1.phpt b/ext/spl/tests/countable_count_variation1.phpt index 3538a20b2..642887d0c 100644 --- a/ext/spl/tests/countable_count_variation1.phpt +++ b/ext/spl/tests/countable_count_variation1.phpt @@ -1,68 +1,68 @@ ---TEST--
-SPL: Countable::count() with wrong return types and exception.
---FILE--
-<?php
-
-Class returnNull implements Countable {
- function count() {
- }
-}
-
-Class returnString implements Countable {
- function count() {
- return "hello";
- }
-}
-
-Class returnObject implements Countable {
- function count() {
- return new returnObject;
- }
-}
-
-Class returnArray implements Countable {
- function count() {
- return array(1,2,3);
- }
-}
-
-Class throwException implements Countable {
- function count() {
- throw new Exception('Thrown from count');
- }
-}
-
-
-echo "Count returns null:\n";
-var_dump(count(new returnNull));
-
-echo "Count returns a string:\n";
-var_dump(count(new returnString));
-
-echo "Count returns an object:\n";
-var_dump(count(new returnObject));
-
-echo "Count returns an array:\n";
-var_dump(count(new returnArray));
-
-echo "Count throws an exception:\n";
-try {
- echo count(new throwException);
-} catch (Exception $e) {
- echo $e->getMessage();
-}
-
-?>
---EXPECTF--
-Count returns null:
-int(0)
-Count returns a string:
-int(0)
-Count returns an object:
-
-Notice: Object of class returnObject could not be converted to int in %s on line 40
-int(1)
-Count returns an array:
-int(1)
-Count throws an exception:
+--TEST-- +SPL: Countable::count() with wrong return types and exception. +--FILE-- +<?php + +Class returnNull implements Countable { + function count() { + } +} + +Class returnString implements Countable { + function count() { + return "hello"; + } +} + +Class returnObject implements Countable { + function count() { + return new returnObject; + } +} + +Class returnArray implements Countable { + function count() { + return array(1,2,3); + } +} + +Class throwException implements Countable { + function count() { + throw new Exception('Thrown from count'); + } +} + + +echo "Count returns null:\n"; +var_dump(count(new returnNull)); + +echo "Count returns a string:\n"; +var_dump(count(new returnString)); + +echo "Count returns an object:\n"; +var_dump(count(new returnObject)); + +echo "Count returns an array:\n"; +var_dump(count(new returnArray)); + +echo "Count throws an exception:\n"; +try { + echo count(new throwException); +} catch (Exception $e) { + echo $e->getMessage(); +} + +?> +--EXPECTF-- +Count returns null: +int(0) +Count returns a string: +int(0) +Count returns an object: + +Notice: Object of class returnObject could not be converted to int in %s on line 40 +int(1) +Count returns an array: +int(1) +Count throws an exception: Thrown from count
\ No newline at end of file diff --git a/ext/spl/tests/dit_002.phpt b/ext/spl/tests/dit_002.phpt index 49e2f4ec7..5e825a1fe 100755 --- a/ext/spl/tests/dit_002.phpt +++ b/ext/spl/tests/dit_002.phpt @@ -44,12 +44,12 @@ foreach ($classes as $class => $flags) { } ?> ===DONE=== ---EXPECT-- +--EXPECTF-- ===DirectoryIterator=== DirectoryIterator ===FilesystemIterator=== SplFileInfo -int(0) +int(%d) int(0) SplFileInfo int(16) diff --git a/ext/spl/tests/dllist_012.phpt b/ext/spl/tests/dllist_012.phpt new file mode 100644 index 000000000..75783fc8c --- /dev/null +++ b/ext/spl/tests/dllist_012.phpt @@ -0,0 +1,29 @@ +--TEST-- +SPL: DoublyLinkedList: recursive var_dump +--FILE-- +<?php +$a = new SplDoublyLinkedList; +$a[] = $a; + +var_dump($a); +?> +===DONE=== +--EXPECT-- +object(SplDoublyLinkedList)#1 (2) { + ["flags":"SplDoublyLinkedList":private]=> + int(0) + ["dllist":"SplDoublyLinkedList":private]=> + array(1) { + [0]=> + object(SplDoublyLinkedList)#1 (2) { + ["flags":"SplDoublyLinkedList":private]=> + int(0) + ["dllist":"SplDoublyLinkedList":private]=> + array(1) { + [0]=> + *RECURSION* + } + } + } +} +===DONE=== diff --git a/ext/spl/tests/heap_012.phpt b/ext/spl/tests/heap_012.phpt new file mode 100644 index 000000000..bf00f50cc --- /dev/null +++ b/ext/spl/tests/heap_012.phpt @@ -0,0 +1,32 @@ +--TEST-- +SPL: SplHeap recursive var_dump +--FILE-- +<?php +$a = new SplMaxHeap; +$a->insert($a); +var_dump($a) +?> +===DONE=== +--EXPECT-- +object(SplMaxHeap)#1 (3) { + ["flags":"SplHeap":private]=> + int(0) + ["isCorrupted":"SplHeap":private]=> + bool(false) + ["heap":"SplHeap":private]=> + array(1) { + [0]=> + object(SplMaxHeap)#1 (3) { + ["flags":"SplHeap":private]=> + int(0) + ["isCorrupted":"SplHeap":private]=> + bool(false) + ["heap":"SplHeap":private]=> + array(1) { + [0]=> + *RECURSION* + } + } + } +} +===DONE=== diff --git a/ext/spl/tests/heap_corruption.phpt b/ext/spl/tests/heap_corruption.phpt index 17f0ac8c2..284ee1db8 100644 --- a/ext/spl/tests/heap_corruption.phpt +++ b/ext/spl/tests/heap_corruption.phpt @@ -1,62 +1,62 @@ ---TEST--
-SPL: SplHeap - heap corruption via compare exception (with top element deletion)
---CREDITS--
-Mike Sullivan <mikesul@php.net>
-#TestFest 2009 (London)
---FILE--
-<?php
-
-class myHeap extends SplHeap
-{
- public $allow_compare = true;
-
- public function compare($v1, $v2)
- {
- if ($this->allow_compare == true)
- {
- if ($v1 > $v2)
- {
- return 1;
- }
- else if ($v1 < $v2)
- {
- return -1;
- }
- else
- {
- return 0;
- }
- }
- else
- {
- throw new Exception('Compare exception');
- }
- }
-}
-
-$heap = new myHeap();
-$heap->insert(1);
-$heap->insert(2);
-$heap->insert(3);
-$heap->insert(4);
-
-$heap->allow_compare = false;
-
-try {
- $heap->extract();
-}
-catch (Exception $e) {
- echo "Compare Exception: " . $e->getMessage() . PHP_EOL;
-}
-
-try {
- $heap->top();
-}
-catch (Exception $e) {
- echo "Corruption Exception: " . $e->getMessage() . PHP_EOL;
-}
-
-?>
---EXPECT--
-Compare Exception: Compare exception
+--TEST-- +SPL: SplHeap - heap corruption via compare exception (with top element deletion) +--CREDITS-- +Mike Sullivan <mikesul@php.net> +#TestFest 2009 (London) +--FILE-- +<?php + +class myHeap extends SplHeap +{ + public $allow_compare = true; + + public function compare($v1, $v2) + { + if ($this->allow_compare == true) + { + if ($v1 > $v2) + { + return 1; + } + else if ($v1 < $v2) + { + return -1; + } + else + { + return 0; + } + } + else + { + throw new Exception('Compare exception'); + } + } +} + +$heap = new myHeap(); +$heap->insert(1); +$heap->insert(2); +$heap->insert(3); +$heap->insert(4); + +$heap->allow_compare = false; + +try { + $heap->extract(); +} +catch (Exception $e) { + echo "Compare Exception: " . $e->getMessage() . PHP_EOL; +} + +try { + $heap->top(); +} +catch (Exception $e) { + echo "Corruption Exception: " . $e->getMessage() . PHP_EOL; +} + +?> +--EXPECT-- +Compare Exception: Compare exception Corruption Exception: Heap is corrupted, heap properties are no longer ensured.
\ No newline at end of file diff --git a/ext/spl/tests/heap_current_variation_001.phpt b/ext/spl/tests/heap_current_variation_001.phpt index a514fb898..eb6df2b88 100644 --- a/ext/spl/tests/heap_current_variation_001.phpt +++ b/ext/spl/tests/heap_current_variation_001.phpt @@ -1,22 +1,22 @@ ---TEST--
-SPL: SplHeap::current - get current value from empty heap
---CREDITS--
-Mike Sullivan <mikesul@php.net>
-#TestFest 2009 (London)
---FILE--
-<?php
-
-class myHeap extends SplHeap
-{
- public function compare($v1, $v2)
- {
- throw new Exception('');
- }
-}
-
-$heap = new myHeap();
-var_dump($heap->current());
-
-?>
---EXPECT--
+--TEST-- +SPL: SplHeap::current - get current value from empty heap +--CREDITS-- +Mike Sullivan <mikesul@php.net> +#TestFest 2009 (London) +--FILE-- +<?php + +class myHeap extends SplHeap +{ + public function compare($v1, $v2) + { + throw new Exception(''); + } +} + +$heap = new myHeap(); +var_dump($heap->current()); + +?> +--EXPECT-- NULL
\ No newline at end of file diff --git a/ext/spl/tests/heap_isempty_variation_001.phpt b/ext/spl/tests/heap_isempty_variation_001.phpt index 78deaa892..dac470fcc 100644 --- a/ext/spl/tests/heap_isempty_variation_001.phpt +++ b/ext/spl/tests/heap_isempty_variation_001.phpt @@ -1,16 +1,16 @@ ---TEST--
-SPL: SplHeap: isEmpty argument variation.
---FILE--
-<?php
-class SplHeap2 extends SplHeap{
-
- public function compare() {
- return -parent::compare();
- }
-}
-
-$h = new SplHeap2;
-$h->isEmpty(1);
-?>
---EXPECTF--
-Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s
+--TEST-- +SPL: SplHeap: isEmpty argument variation. +--FILE-- +<?php +class SplHeap2 extends SplHeap{ + + public function compare() { + return -parent::compare(); + } +} + +$h = new SplHeap2; +$h->isEmpty(1); +?> +--EXPECTF-- +Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s diff --git a/ext/spl/tests/iterator_count.phpt b/ext/spl/tests/iterator_count.phpt index 1db568d14..9aa4e1197 100644 --- a/ext/spl/tests/iterator_count.phpt +++ b/ext/spl/tests/iterator_count.phpt @@ -1,26 +1,26 @@ ---TEST--
-SPL: iterator_count() exceptions test
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-$array=array('a','b');
-
-$iterator = new ArrayIterator($array);
-
-iterator_count();
-
-
-iterator_count($iterator,'1');
-
-iterator_count('1');
-
-
-?>
---EXPECTF--
-Warning: iterator_count() expects exactly 1 parameter, 0 given in %s
-
-Warning: iterator_count() expects exactly 1 parameter, 2 given in %s
-
-Catchable fatal error: Argument 1 passed to iterator_count() must implement interface Traversable, %unicode_string_optional% given %s
+--TEST-- +SPL: iterator_count() exceptions test +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php +$array=array('a','b'); + +$iterator = new ArrayIterator($array); + +iterator_count(); + + +iterator_count($iterator,'1'); + +iterator_count('1'); + + +?> +--EXPECTF-- +Warning: iterator_count() expects exactly 1 parameter, 0 given in %s + +Warning: iterator_count() expects exactly 1 parameter, 2 given in %s + +Catchable fatal error: Argument 1 passed to iterator_count() must implement interface Traversable, %unicode_string_optional% given %s diff --git a/ext/spl/tests/iterator_to_array.phpt b/ext/spl/tests/iterator_to_array.phpt index 574e050b9..958d370cc 100644 --- a/ext/spl/tests/iterator_to_array.phpt +++ b/ext/spl/tests/iterator_to_array.phpt @@ -1,25 +1,25 @@ ---TEST--
-SPL: iterator_to_array() exceptions test
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-$array=array('a','b');
-
-$iterator = new ArrayIterator($array);
-
-iterator_to_array();
-
-
-iterator_to_array($iterator,'test','test');
-
-iterator_to_array('test','test');
-
-?>
---EXPECTF--
-Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s
-
-Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s
-
-Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, %unicode_string_optional% given %s
+--TEST-- +SPL: iterator_to_array() exceptions test +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php +$array=array('a','b'); + +$iterator = new ArrayIterator($array); + +iterator_to_array(); + + +iterator_to_array($iterator,'test','test'); + +iterator_to_array('test','test'); + +?> +--EXPECTF-- +Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s + +Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s + +Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, %unicode_string_optional% given %s diff --git a/ext/spl/tests/recursive_tree_iterator_setprefixpart.phpt b/ext/spl/tests/recursive_tree_iterator_setprefixpart.phpt index f5af0dd4a..81c853f30 100644 --- a/ext/spl/tests/recursive_tree_iterator_setprefixpart.phpt +++ b/ext/spl/tests/recursive_tree_iterator_setprefixpart.phpt @@ -1,32 +1,32 @@ ---TEST--
-SPL: RecursiveTreeIterator::setPrefixPart() Test arguments
---CREDITS--
-Roshan Abraham (roshanabrahams@gmail.com)
-TestFest London May 2009
---FILE--
-<?php
-
-$arr = array(
- "a" => array("b")
-);
-
-$it = new RecursiveArrayIterator($arr);
-$it = new RecursiveTreeIterator($it);
-
-$it->setPrefixPart(1); // Should throw a warning as setPrefixPart expects 2 arguments
-
-$a = new stdClass();
-$it->setPrefixPart($a, 1); // Should throw a warning as setPrefixPart expects argument 1 to be long integer
-
-$it->setPrefixPart(1, $a); // Should throw a warning as setPrefixPart expects argument 2 to be a string
-
-
-?>
-===DONE===
---EXPECTF--
-Warning: RecursiveTreeIterator::setPrefixPart() expects exactly 2 parameters, 1 given in %s on line %d
-
-Warning: RecursiveTreeIterator::setPrefixPart() expects parameter 1 to be long, object given in %s on line %d
-
-Warning: RecursiveTreeIterator::setPrefixPart() expects parameter 2 to be %binary_string_optional%, object given in %s on line %d
-===DONE===
+--TEST-- +SPL: RecursiveTreeIterator::setPrefixPart() Test arguments +--CREDITS-- +Roshan Abraham (roshanabrahams@gmail.com) +TestFest London May 2009 +--FILE-- +<?php + +$arr = array( + "a" => array("b") +); + +$it = new RecursiveArrayIterator($arr); +$it = new RecursiveTreeIterator($it); + +$it->setPrefixPart(1); // Should throw a warning as setPrefixPart expects 2 arguments + +$a = new stdClass(); +$it->setPrefixPart($a, 1); // Should throw a warning as setPrefixPart expects argument 1 to be long integer + +$it->setPrefixPart(1, $a); // Should throw a warning as setPrefixPart expects argument 2 to be a string + + +?> +===DONE=== +--EXPECTF-- +Warning: RecursiveTreeIterator::setPrefixPart() expects exactly 2 parameters, 1 given in %s on line %d + +Warning: RecursiveTreeIterator::setPrefixPart() expects parameter 1 to be long, object given in %s on line %d + +Warning: RecursiveTreeIterator::setPrefixPart() expects parameter 2 to be %binary_string_optional%, object given in %s on line %d +===DONE=== diff --git a/ext/spl/tests/regexiterator_getpregflags.phpt b/ext/spl/tests/regexiterator_getpregflags.phpt index db961538d..58a4dc4a3 100644 --- a/ext/spl/tests/regexiterator_getpregflags.phpt +++ b/ext/spl/tests/regexiterator_getpregflags.phpt @@ -1,33 +1,33 @@ ---TEST--
-SPL: RegexIterator::getPregFlags()
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-
-class myIterator implements Iterator {
-
-function current (){}
-function key ( ){}
-function next ( ){}
-function rewind ( ){}
-function valid ( ){}
-
-
-}
-
-class TestRegexIterator extends RegexIterator{}
-
-$rege = '/^a/';
-
-
-$r = new TestRegexIterator(new myIterator, $rege);
-
-$r->setPregFlags(PREG_OFFSET_CAPTURE);
-
-echo is_long($r->getPregFlags());
-
-?>
---EXPECTF--
+--TEST-- +SPL: RegexIterator::getPregFlags() +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php + +class myIterator implements Iterator { + +function current (){} +function key ( ){} +function next ( ){} +function rewind ( ){} +function valid ( ){} + + +} + +class TestRegexIterator extends RegexIterator{} + +$rege = '/^a/'; + + +$r = new TestRegexIterator(new myIterator, $rege); + +$r->setPregFlags(PREG_OFFSET_CAPTURE); + +echo is_long($r->getPregFlags()); + +?> +--EXPECTF-- 1
\ No newline at end of file diff --git a/ext/spl/tests/regexiterator_setflags_exception.phpt b/ext/spl/tests/regexiterator_setflags_exception.phpt index 66c82b159..fdc8bca64 100644 --- a/ext/spl/tests/regexiterator_setflags_exception.phpt +++ b/ext/spl/tests/regexiterator_setflags_exception.phpt @@ -1,35 +1,35 @@ ---TEST--
-SPL: RegexIterator::setFlags() exceptions test
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-
-class myIterator implements Iterator {
-
-function current (){}
-function key ( ){}
-function next ( ){}
-function rewind ( ){}
-function valid ( ){}
-
-
-}
-
-class TestRegexIterator extends RegexIterator{}
-
-$rege = '/^a/';
-
-
-$r = new TestRegexIterator(new myIterator, $rege);
-
-try{
- $r->setFlags();
-}catch (Exception $e) {
- echo $e->getMessage();
-}
-
-?>
---EXPECTF--
+--TEST-- +SPL: RegexIterator::setFlags() exceptions test +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php + +class myIterator implements Iterator { + +function current (){} +function key ( ){} +function next ( ){} +function rewind ( ){} +function valid ( ){} + + +} + +class TestRegexIterator extends RegexIterator{} + +$rege = '/^a/'; + + +$r = new TestRegexIterator(new myIterator, $rege); + +try{ + $r->setFlags(); +}catch (Exception $e) { + echo $e->getMessage(); +} + +?> +--EXPECTF-- Warning: RegexIterator::setFlags() expects exactly 1 parameter, 0 given in %s
\ No newline at end of file diff --git a/ext/spl/tests/regexiterator_setpregflags.phpt b/ext/spl/tests/regexiterator_setpregflags.phpt index a14da6164..ea1b45548 100644 --- a/ext/spl/tests/regexiterator_setpregflags.phpt +++ b/ext/spl/tests/regexiterator_setpregflags.phpt @@ -1,34 +1,34 @@ ---TEST--
-SPL: RegexIterator::setPregFlags()
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-
-class myIterator implements Iterator {
-
-function current (){}
-function key ( ){}
-function next ( ){}
-function rewind ( ){}
-function valid ( ){}
-
-
-}
-
-class TestRegexIterator extends RegexIterator{}
-
-$rege = '/^a/';
-
-
-$r = new TestRegexIterator(new myIterator, $rege);
-
-$r->setPregFlags(PREG_OFFSET_CAPTURE);
-
-echo $r->getPregFlags();
-
-
-?>
---EXPECTF--
+--TEST-- +SPL: RegexIterator::setPregFlags() +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php + +class myIterator implements Iterator { + +function current (){} +function key ( ){} +function next ( ){} +function rewind ( ){} +function valid ( ){} + + +} + +class TestRegexIterator extends RegexIterator{} + +$rege = '/^a/'; + + +$r = new TestRegexIterator(new myIterator, $rege); + +$r->setPregFlags(PREG_OFFSET_CAPTURE); + +echo $r->getPregFlags(); + + +?> +--EXPECTF-- 256
\ No newline at end of file diff --git a/ext/spl/tests/regexiterator_setpregflags_exception.phpt b/ext/spl/tests/regexiterator_setpregflags_exception.phpt index 489505ce5..cc7c17c27 100644 --- a/ext/spl/tests/regexiterator_setpregflags_exception.phpt +++ b/ext/spl/tests/regexiterator_setpregflags_exception.phpt @@ -1,36 +1,36 @@ ---TEST--
-SPL: RegexIterator::getPregFlags() exception test
---CREDITS--
-Lance Kesson jac_kesson@hotmail.com
-#testfest London 2009-05-09
---FILE--
-<?php
-
-class myIterator implements Iterator {
-
-function current (){}
-function key ( ){}
-function next ( ){}
-function rewind ( ){}
-function valid ( ){}
-
-
-}
-
-class TestRegexIterator extends RegexIterator{}
-
-$rege = '/^a/';
-
-
-$r = new TestRegexIterator(new myIterator, $rege);
-
-
-try{
- $r->setPregFlags();
-}catch (Exception $e) {
- echo $e->getMessage();
-}
-
-?>
---EXPECTF--
+--TEST-- +SPL: RegexIterator::getPregFlags() exception test +--CREDITS-- +Lance Kesson jac_kesson@hotmail.com +#testfest London 2009-05-09 +--FILE-- +<?php + +class myIterator implements Iterator { + +function current (){} +function key ( ){} +function next ( ){} +function rewind ( ){} +function valid ( ){} + + +} + +class TestRegexIterator extends RegexIterator{} + +$rege = '/^a/'; + + +$r = new TestRegexIterator(new myIterator, $rege); + + +try{ + $r->setPregFlags(); +}catch (Exception $e) { + echo $e->getMessage(); +} + +?> +--EXPECTF-- Warning: RegexIterator::setPregFlags() expects exactly 1 parameter, 0 given in %s
\ No newline at end of file diff --git a/ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt b/ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt index cd4ea5b03..cd4ea5b03 100644 --- a/ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt +++ b/ext/spl/tests/splDoublyLinkedList_shift_noParams.phpt diff --git a/ext/spl/tests/spl_autoload_013.phpt b/ext/spl/tests/spl_autoload_013.phpt new file mode 100644 index 000000000..44d4d857f --- /dev/null +++ b/ext/spl/tests/spl_autoload_013.phpt @@ -0,0 +1,51 @@ +--TEST-- +SPL: spl_autoload_functions() with closures and invokables +--FILE-- +<?php +$closure = function($class) { + echo "a called\n"; +}; + +class Autoloader { + private $dir; + public function __construct($dir) { + $this->dir = $dir; + } + public function __invoke($class) { + var_dump("{$this->dir}/$class.php"); + } +} + +$al1 = new Autoloader('d1'); +$al2 = new Autoloader('d2'); + +spl_autoload_register($closure); +spl_autoload_register($al1); +spl_autoload_register($al2); + +var_dump(spl_autoload_functions()); + +?> +===DONE=== +--EXPECTF-- +array(3) { + [0]=> + object(Closure)#%d (1) { + ["parameter"]=> + array(1) { + ["$class"]=> + string(10) "<required>" + } + } + [1]=> + object(Autoloader)#%d (1) { + ["dir":"Autoloader":private]=> + string(2) "d1" + } + [2]=> + object(Autoloader)#%d (1) { + ["dir":"Autoloader":private]=> + string(2) "d2" + } +} +===DONE===
\ No newline at end of file diff --git a/ext/spl/tests/spl_autoload_014.phpt b/ext/spl/tests/spl_autoload_014.phpt new file mode 100644 index 000000000..a68fcb7e6 --- /dev/null +++ b/ext/spl/tests/spl_autoload_014.phpt @@ -0,0 +1,47 @@ +--TEST-- +SPL: spl_autoload_unregister() with closures and invokables +--FILE-- +<?php +$closure = function($class) { + echo "closure called with class $class\n"; +}; + +class Autoloader { + private $dir; + public function __construct($dir) { + $this->dir = $dir; + } + public function __invoke($class) { + echo ("Autoloader('{$this->dir}') called with $class\n"); + } +} + +class WorkingAutoloader { + public function __invoke($class) { + echo ("WorkingAutoloader() called with $class\n"); + eval("class $class { }"); + } +} + +$al1 = new Autoloader('d1'); +$al2 = new WorkingAutoloader('d2'); + +spl_autoload_register($closure); +spl_autoload_register($al1); +spl_autoload_register($al2); + +$x = new TestX; + +spl_autoload_unregister($closure); +spl_autoload_unregister($al1); + +$y = new TestY; + +?> +===DONE=== +--EXPECT-- +closure called with class TestX +Autoloader('d1') called with TestX +WorkingAutoloader() called with TestX +WorkingAutoloader() called with TestY +===DONE===
\ No newline at end of file diff --git a/ext/spl/tests/spl_autoload_bug48541.phpt b/ext/spl/tests/spl_autoload_bug48541.phpt index eef81bd03..9937a7f42 100644 --- a/ext/spl/tests/spl_autoload_bug48541.phpt +++ b/ext/spl/tests/spl_autoload_bug48541.phpt @@ -2,23 +2,38 @@ SPL: spl_autoload_register() Bug #48541: registering multiple closures fails with memleaks --FILE-- <?php + +class X { + public function getClosure() { + return function($class) { + echo "a2 called\n"; + }; + } +} + $a = function ($class) { echo "a called\n"; }; +$x = new X; +$a2 = $x->getClosure(); $b = function ($class) { eval('class ' . $class . '{function __construct(){echo "foo\n";}}'); echo "b called\n"; }; spl_autoload_register($a); +spl_autoload_register($a2); spl_autoload_register($b); $c = $a; +$c2 = $a2; spl_autoload_register($c); +spl_autoload_register($c2); $c = new foo; ?> ===DONE=== --EXPECT-- a called +a2 called b called foo ===DONE===
\ No newline at end of file diff --git a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt index 9e3debfa9..399d9a31a 100755 --- a/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt +++ b/ext/spl/tests/spl_fileinfo_getlinktarget_basic.phpt @@ -1,22 +1,22 @@ ---TEST--
-SPL: Spl File Info test getLinkTarget
---CREDITS--
-Nataniel McHugh nat@fishtrap.co.uk
---SKIPIF--
-<?php
-if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms");
-?>
---FILE--
-<?php
-$link = 'test_link';
-symlink(__FILE__, $link );
-$fileInfo = new SplFileInfo($link);
-
-if ($fileInfo->isLink()) {
- echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL;
-}
-var_dump(unlink($link));
-?>
---EXPECT--
-same
-bool(true)
+--TEST-- +SPL: Spl File Info test getLinkTarget +--CREDITS-- +Nataniel McHugh nat@fishtrap.co.uk +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test not for Windows platforms"); +?> +--FILE-- +<?php +$link = 'test_link'; +symlink(__FILE__, $link ); +$fileInfo = new SplFileInfo($link); + +if ($fileInfo->isLink()) { + echo $fileInfo->getLinkTarget() == __FILE__ ? 'same' : 'different',PHP_EOL; +} +var_dump(unlink($link)); +?> +--EXPECT-- +same +bool(true) diff --git a/ext/spl/tests/spl_heap_is_empty_basic.phpt b/ext/spl/tests/spl_heap_is_empty_basic.phpt index 7c2937918..47d7ccce9 100644 --- a/ext/spl/tests/spl_heap_is_empty_basic.phpt +++ b/ext/spl/tests/spl_heap_is_empty_basic.phpt @@ -1,31 +1,31 @@ ---TEST--
-SPL: SplHeap, test trivial method to find if a heap is empty
---CREDITS--
-Nathaniel McHugh nat@fishtrap.co.uk
-#testfest London 2009-05-09
---FILE--
-<?php
-
-class MyHeap extends SplHeap{
-
-public function compare($a, $b){
-return $a < $b;
-}
-
-}
-
-
-$heap = new MyHeap();
-var_dump($heap->isEmpty());
-$heap->insert(1);
-var_dump($heap->isEmpty());
-$heap->extract();
-var_dump($heap->isEmpty());
-$heap->isEmpty('var');
-?>
---EXPECTF--
-bool(true)
-bool(false)
-bool(true)
-
-Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s
+--TEST-- +SPL: SplHeap, test trivial method to find if a heap is empty +--CREDITS-- +Nathaniel McHugh nat@fishtrap.co.uk +#testfest London 2009-05-09 +--FILE-- +<?php + +class MyHeap extends SplHeap{ + +public function compare($a, $b){ +return $a < $b; +} + +} + + +$heap = new MyHeap(); +var_dump($heap->isEmpty()); +$heap->insert(1); +var_dump($heap->isEmpty()); +$heap->extract(); +var_dump($heap->isEmpty()); +$heap->isEmpty('var'); +?> +--EXPECTF-- +bool(true) +bool(false) +bool(true) + +Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s diff --git a/ext/spl/tests/spl_heap_isempty.phpt b/ext/spl/tests/spl_heap_isempty.phpt index 5d3e4cafc..2729c7fa8 100644 --- a/ext/spl/tests/spl_heap_isempty.phpt +++ b/ext/spl/tests/spl_heap_isempty.phpt @@ -1,21 +1,21 @@ ---TEST--
-SPL: Test of isEmpty for SPL Max Heap
---CREDITS--
-Rohan Abraham (rohanabrahams@gmail.com)
-TestFest London May 2009
---FILE--
-<?php
- $h = new SplMaxHeap();
- echo "Checking a new heap is empty: ";
- var_dump($h->isEmpty())."\n";
- $h->insert(2);
- echo "Checking after insert: ";
- var_dump($h->isEmpty())."\n";
- $h->extract();
- echo "Checking after extract: ";
- var_dump($h->isEmpty())."\n";
-?>
---EXPECT--
-Checking a new heap is empty: bool(true)
-Checking after insert: bool(false)
+--TEST-- +SPL: Test of isEmpty for SPL Max Heap +--CREDITS-- +Rohan Abraham (rohanabrahams@gmail.com) +TestFest London May 2009 +--FILE-- +<?php + $h = new SplMaxHeap(); + echo "Checking a new heap is empty: "; + var_dump($h->isEmpty())."\n"; + $h->insert(2); + echo "Checking after insert: "; + var_dump($h->isEmpty())."\n"; + $h->extract(); + echo "Checking after extract: "; + var_dump($h->isEmpty())."\n"; +?> +--EXPECT-- +Checking a new heap is empty: bool(true) +Checking after insert: bool(false) Checking after extract: bool(true)
\ No newline at end of file diff --git a/ext/spl/tests/spl_pq_top_basic.phpt b/ext/spl/tests/spl_pq_top_basic.phpt index df85237a8..dcc1cbe4c 100644 --- a/ext/spl/tests/spl_pq_top_basic.phpt +++ b/ext/spl/tests/spl_pq_top_basic.phpt @@ -1,42 +1,42 @@ ---TEST--
-SPL: SplPriorityQueue: top and extract flags
---CREDITS--
-Nathaniel McHugh nat@fishtrap.co.uk
-#testfest London 2009-05-09
---FILE--
-<?php
-
-$priorityQueue = new SplPriorityQueue();
-
-$priorityQueue->insert("a", 1);
-$priorityQueue->insert("b", 2);
-$priorityQueue->insert("c", 0);
-
-echo "EXTR DEFAULT",PHP_EOL;
-echo "value: ",$priorityQueue->top(),PHP_EOL;
-
-$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY);
-echo "EXTR_PRIORITY",PHP_EOL;
-echo "priority: ",$priorityQueue->top(),PHP_EOL;
-
-$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH);
-echo "EXTR_BOTH",PHP_EOL;
-print_r($priorityQueue->top());
-
-echo "EXTR_DATA",PHP_EOL;
-$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA);
-echo "value: ",$priorityQueue->top(),PHP_EOL;
-?>
---EXPECT--
-EXTR DEFAULT
-value: b
-EXTR_PRIORITY
-priority: 2
-EXTR_BOTH
-Array
-(
- [data] => b
- [priority] => 2
-)
-EXTR_DATA
+--TEST-- +SPL: SplPriorityQueue: top and extract flags +--CREDITS-- +Nathaniel McHugh nat@fishtrap.co.uk +#testfest London 2009-05-09 +--FILE-- +<?php + +$priorityQueue = new SplPriorityQueue(); + +$priorityQueue->insert("a", 1); +$priorityQueue->insert("b", 2); +$priorityQueue->insert("c", 0); + +echo "EXTR DEFAULT",PHP_EOL; +echo "value: ",$priorityQueue->top(),PHP_EOL; + +$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_PRIORITY); +echo "EXTR_PRIORITY",PHP_EOL; +echo "priority: ",$priorityQueue->top(),PHP_EOL; + +$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_BOTH); +echo "EXTR_BOTH",PHP_EOL; +print_r($priorityQueue->top()); + +echo "EXTR_DATA",PHP_EOL; +$priorityQueue->setExtractFlags(SplPriorityQueue::EXTR_DATA); +echo "value: ",$priorityQueue->top(),PHP_EOL; +?> +--EXPECT-- +EXTR DEFAULT +value: b +EXTR_PRIORITY +priority: 2 +EXTR_BOTH +Array +( + [data] => b + [priority] => 2 +) +EXTR_DATA value: b
\ No newline at end of file diff --git a/ext/spl/tests/spl_pq_top_error_corrupt.phpt b/ext/spl/tests/spl_pq_top_error_corrupt.phpt index ea3e1fe50..30b6fde5a 100644 --- a/ext/spl/tests/spl_pq_top_error_corrupt.phpt +++ b/ext/spl/tests/spl_pq_top_error_corrupt.phpt @@ -1,9 +1,9 @@ ---TEST--
-SPL: SplPriorityQueue: top and extract flags
---CREDITS--
-Nathaniel McHugh nat@fishtrap.co.uk
-#testfest 2009-05-09
---FILE--
+--TEST-- +SPL: SplPriorityQueue: top and extract flags +--CREDITS-- +Nathaniel McHugh nat@fishtrap.co.uk +#testfest 2009-05-09 +--FILE-- <?php class myPriorityQueue extends SplPriorityQueue{ @@ -17,21 +17,22 @@ class myPriorityQueue extends SplPriorityQueue{ } } -$priorityQueue = new myPriorityQueue();
-$priorityQueue->insert("a", 1);
-try {
- //corrupt heap
+$priorityQueue = new myPriorityQueue(); +$priorityQueue->insert("a", 1); + +try { + //corrupt heap $priorityQueue->insert("b", 2); - // ignore exception tested elsewhere
-} catch (Exception $e) {
-}
-
-try {
- $priorityQueue->top();
-} catch (RuntimeException $e) {
- echo "Exception: ".$e->getMessage().PHP_EOL;
-}
-
-?>
---EXPECT--
+ // ignore exception tested elsewhere +} catch (Exception $e) { +} + +try { + $priorityQueue->top(); +} catch (RuntimeException $e) { + echo "Exception: ".$e->getMessage().PHP_EOL; +} + +?> +--EXPECT-- Exception: Heap is corrupted, heap properties are no longer ensured. diff --git a/ext/spl/tests/spl_pq_top_error_empty.phpt b/ext/spl/tests/spl_pq_top_error_empty.phpt index 129a04891..9e2a31bbc 100644 --- a/ext/spl/tests/spl_pq_top_error_empty.phpt +++ b/ext/spl/tests/spl_pq_top_error_empty.phpt @@ -1,19 +1,19 @@ ---TEST--
-SPL: SplPriorityQueue: top exception on empty heap
---CREDITS--
-Nathaniel McHugh nat@fishtrap.co.uk
-#testfest 2009-05-09
---FILE--
+--TEST-- +SPL: SplPriorityQueue: top exception on empty heap +--CREDITS-- +Nathaniel McHugh nat@fishtrap.co.uk +#testfest 2009-05-09 +--FILE-- <?php -
-$priorityQueue = new SplPriorityQueue();
-
-try {
- $priorityQueue->top();
-} catch (RuntimeException $e) {
- echo "Exception: ".$e->getMessage().PHP_EOL;
-}
-
-?>
---EXPECT--
+ +$priorityQueue = new SplPriorityQueue(); + +try { + $priorityQueue->top(); +} catch (RuntimeException $e) { + echo "Exception: ".$e->getMessage().PHP_EOL; +} + +?> +--EXPECT-- Exception: Can't peek at an empty heap diff --git a/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt b/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt index 249830859..1262ec0d6 100644 --- a/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt +++ b/ext/spl/tests/spl_recursive_iterator_iterator_key_case.phpt @@ -1,33 +1,33 @@ ---TEST--
-SPL: Test on RecursiveIteratorIterator key function checking switch statements
---CREDITS--
-Rohan Abraham (rohanabrahams@gmail.com)
-TestFest London May 2009
---FILE--
-<?php
- $ar = array("one"=>1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, NULL => "null");
- $it = new RecursiveArrayIterator($ar);
- $it = new RecursiveIteratorIterator($it);
- foreach($it as $k=>$v)
- {
- echo "$k=>$v\n";
- var_dump($k);
- }
-?>
---EXPECTF--
-one=>1
-%unicode|string%(3) "one"
-two=>2
-%unicode|string%(3) "two"
-four=>4
-%unicode|string%(4) "four"
-five=>5
-%unicode|string%(4) "five"
-seven=>7
-%unicode|string%(5) "seven"
-eight=>8
-%unicode|string%(5) "eight"
--100=>10
-int(-100)
-=>null
-%unicode|string%(0) ""
+--TEST-- +SPL: Test on RecursiveIteratorIterator key function checking switch statements +--CREDITS-- +Rohan Abraham (rohanabrahams@gmail.com) +TestFest London May 2009 +--FILE-- +<?php + $ar = array("one"=>1, "two"=>2, "three"=>array("four"=>4, "five"=>5, "six"=>array("seven"=>7)), "eight"=>8, -100 => 10, NULL => "null"); + $it = new RecursiveArrayIterator($ar); + $it = new RecursiveIteratorIterator($it); + foreach($it as $k=>$v) + { + echo "$k=>$v\n"; + var_dump($k); + } +?> +--EXPECTF-- +one=>1 +%unicode|string%(3) "one" +two=>2 +%unicode|string%(3) "two" +four=>4 +%unicode|string%(4) "four" +five=>5 +%unicode|string%(4) "five" +seven=>7 +%unicode|string%(5) "seven" +eight=>8 +%unicode|string%(5) "eight" +-100=>10 +int(-100) +=>null +%unicode|string%(0) "" diff --git a/ext/spl/tests/SplFixedarray_offsetExists_larger.phpt b/ext/spl/tests/splfixedarray_offsetExists_larger.phpt index 9449d64d8..9449d64d8 100644 --- a/ext/spl/tests/SplFixedarray_offsetExists_larger.phpt +++ b/ext/spl/tests/splfixedarray_offsetExists_larger.phpt |
