--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Check that SplArray::fromArray will not allow integer overflows
+--CREDITS--
+Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
+--FILE--
+<?php
+$array = array(PHP_INT_MAX => 'foo');
+$splArray = new SplFixedArray();
+
+try {
+ $splArray->fromArray($array);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECT--
+integer overflow detected
\ No newline at end of file
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList::count fails if parameter passed in
+--CREDITS--
+Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+
+$c = $list->count('foo');
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::count() expects exactly 0 parameters, 1 given in %s on line 4
--- /dev/null
+--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
--- /dev/null
+--TEST--
+SplDoublyLinkedList getIteratorMode
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+var_dump($list->current());
+?>
+--EXPECT--
+NULL
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList returns debug info when print_r is used.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ // Check the debug info
+ print_r($dll);
+?>
+--EXPECT--
+SplDoublyLinkedList Object
+(
+ [flags:SplDoublyLinkedList:private] => 0
+ [dllist:SplDoublyLinkedList:private] => Array
+ (
+ [0] => 1
+ [1] => 2
+ [2] => 3
+ )
+
+)
--- /dev/null
+--TEST--
+SplDoublyLinkedList getIteratorMode
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_KEEP);
+echo $list->getIteratorMode();
+?>
+--EXPECT--
+0
--- /dev/null
+--TEST--
+SplDoublyLinkedList getIteratorMode with an unexpected parameter
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$list->getIteratorMode(24);
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::getIteratorMode() expects exactly 0 parameters, 1 given in %s on line %d
+
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->isEmpty() returns an error message when a parameter is passed.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ var_dump($dll->isEmpty("test"));
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::isEmpty() expects exactly 0 parameters, %d given in %s
+NULL
\ No newline at end of file
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->isEmpty() correctly returns true for an empty list.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ var_dump($dll->isEmpty());
+?>
+--EXPECT--
+bool(true)
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->isEmpty() returns an error message when a parameter is passed.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+ //var_dump($dll);
+
+ var_dump($dll->isEmpty("test"));
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::isEmpty() expects exactly 0 parameters, %d given in %s
+NULL
\ No newline at end of file
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->isEmpty() correctly returns true for a non-empty list.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+ //var_dump($dll);
+
+ var_dump($dll->isEmpty());
+?>
+--EXPECT--
+bool(false)
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList can traverse backwards
+--CREDITS--
+Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+
+$list->push('o');
+$list->push('o');
+$list->push('f');
+
+$list->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+$list->rewind();
+
+while ($tmp = $list->current()) {
+ echo $tmp;
+ $list->next();
+}
+?>
+--EXPECT--
+foo
\ No newline at end of file
--- /dev/null
+--TEST--
+SPL SplDoublyLinkedList offsetExists displays warning and returns null on no parameters
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$a = $list->offsetExists();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::offsetExists() expects exactly 1 parameter, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SPL SplDoublyLinkedList offsetExists returns correct values
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+
+// Push two values onto the list
+$list->push('abc');
+$list->push('def');
+
+// Validate that we can see the first value
+if($list->offsetExists(0) === true) {
+ echo "PASS\n";
+}
+
+// Validate that we can see the second value
+if($list->offsetExists(1) === true) {
+ echo "PASS\n";
+}
+
+// Check that there is no third value
+if($list->offsetExists(2) === false) {
+ echo "PASS\n";
+}
+?>
+--EXPECTF--
+PASS
+PASS
+PASS
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Tests that the offsetGet() method throws an error when no argument is sent
+--CREDITS--
+PHPNW Test Fest 2009 - Rick Ogden
+--FILE--
+<?php
+$dll = new SplDoublyLinkedList();
+$dll->push(1);
+$dll->push(2);
+
+var_dump($dll->offsetGet());
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::offsetGet() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+SplDoublyLinkedList offsetSet throws error on no parameters
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$a = $list->offsetSet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::offsetSet() expects exactly 2 parameters, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SplDoublyLinkedList offsetSet throws error only one parameter
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$a = $list->offsetSet(2);
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::offsetSet() expects exactly 2 parameters, 1 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+Doubly Linked List - offsetUnset > number elements
+
+--CREDITS--
+PHPNW Test Fest 2009 - Mat Griffin
+
+--FILE--
+<?php
+$ll = new SplDoublyLinkedList();
+
+$ll->push('1');
+$ll->push('2');
+$ll->push('3');
+
+try {
+
+$ll->offsetUnset($ll->count() + 1);
+
+var_dump($ll);
+
+} catch(Exception $e) {
+echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Offset out of range
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->offsetUnset() returns an error message when the offset is < 0.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ try {
+ $dll->offsetUnset(-1);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+?>
+--EXPECT--
+Offset out of range
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList->offsetUnset() returns an error message when the offset is > elements.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a new Doubly Linked List
+ $dll = new SplDoublyLinkedList();
+
+ // Add some items to the list
+ $dll->push(1);
+ $dll->push(2);
+ $dll->push(3);
+
+ try {
+ $dll->offsetUnset(3);
+ }
+ catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+ }
+?>
+--EXPECT--
+Offset out of range
--- /dev/null
+--TEST--
+Checks that the pop() method of DoublyLinkedList does not accept args.
+--CREDITS--
+PHPNW Test Fest 2009 - Rick Ogden
+--FILE--
+<?php
+$ll = new SplDoublyLinkedList();
+$ll->push(1);
+$ll->push(2);
+
+var_dump($ll->pop(1));
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::pop() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList::push generate a warning and return NULL with missing param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+$dll = new SplDoublyLinkedList();
+var_dump($dll->push());
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::push() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Checks that the shift() method of DoublyLinkedList does not accept args.
+--CREDITS--
+PHPNW Test Fest 2009 - Rick Ogden
+--FILE--
+<?php
+$ll = new SplDoublyLinkedList();
+$ll->push(1);
+$ll->push(2);
+
+var_dump($ll->shift(1));
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::shift() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Check that SplDoublyLinkedList::unshift generate a warning and return NULL with missing param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+$dll = new SplDoublyLinkedList();
+var_dump($dll->unshift());
+?>
+--EXPECTF--
+Warning: SplDoublyLinkedList::unshift() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+SPL: SplDoublyLinkedList : offsetUnset - first element
+--CREDITS--
+PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org>
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$list->push('oh');
+$list->push('hai');
+$list->push('thar');
+$list->offsetUnset(0);
+var_dump($list);
+?>
+--EXPECTF--
+object(SplDoublyLinkedList)#1 (2) {
+ [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=>
+ int(0)
+ [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ %string|unicode%(3) "hai"
+ [1]=>
+ %string|unicode%(4) "thar"
+ }
+}
--- /dev/null
+--TEST--
+SPL: SplDoublyLinkedList : offsetUnset - first element
+--CREDITS--
+PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org>
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$list->push('oh');
+$list->push('hai');
+$list->push('thar');
+echo $list->bottom() . "\n";
+$list->offsetUnset(0);
+echo $list->bottom() . "\n";
+?>
+--EXPECT--
+oh
+hai
--- /dev/null
+--TEST--
+SPL: SplDoublyLinkedList : offsetUnset - last element
+--CREDITS--
+PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org>
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+$list->push('oh');
+$list->push('hai');
+$list->push('thar');
+$list->offsetUnset(2);
+var_dump($list);
+?>
+--EXPECTF--
+object(SplDoublyLinkedList)#1 (2) {
+ [%u|b%"flags":%u|b%"SplDoublyLinkedList":private]=>
+ int(0)
+ [%u|b%"dllist":%u|b%"SplDoublyLinkedList":private]=>
+ array(2) {
+ [0]=>
+ %string|unicode%(2) "oh"
+ [1]=>
+ %string|unicode%(3) "hai"
+ }
+}
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+Makes sure that an integer cannot be passed into the count() method of the splFixedArray.
+--CREDITS--
+PHPNW Test Fest 2009 - Rick Ogden
+--FILE--
+<?php
+$ar = new SplFixedArray(3);
+$ar[0] = 1;
+$ar[1] = 2;
+$ar[2] = 3;
+
+echo $ar->count(3);
+?>
+--EXPECTF--
+Warning: SplFixedArray::count() expects exactly 0 parameters, 1 given in %s on line %d
+
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+pass an integer into fromArray()
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+echo SplFixedArray::fromArray(17954);
+?>
+--EXPECTF--
+Warning: SplFixedArray::fromArray() expects parameter 1 to be array, integer given in %s on line %d
--- /dev/null
+--TEST--
+pass a string into fromArray()
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+echo SplFixedArray::fromArray('hello');
+?>
+--EXPECTF--
+Warning: SplFixedArray::fromArray() expects parameter 1 to be array, %unicode_string_optional% given in %s on line %d
--- /dev/null
+--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)
+}
--- /dev/null
+--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)
+}
--- /dev/null
+--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
--- /dev/null
+--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"
+ }
+}
--- /dev/null
+--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*
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/null
+--TEST--
+SPL FixedArray offsetExists throws error only one parameter
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$a = $array->offsetExists();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplFixedArray::offsetExists() expects exactly 1 parameter, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SPL FixedArray offsetExists behaviour on a negative index
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+if($array->offsetExists(-10) === false) {
+ echo 'PASS';
+}
+?>
+--EXPECT--
+PASS
--- /dev/null
+--TEST--
+SPL FixedArray offsetGet throws error on no parameter
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$array[0] = 'a';
+$a = $array->offsetGet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplFixedArray::offsetGet() expects exactly 1 parameter, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SPL FixedArray offsetSet throws error on no parameters
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$a = $array->offsetSet();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplFixedArray::offsetSet() expects exactly 2 parameters, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SPL FixedArray offsetSet throws error only one parameter
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$a = $array->offsetSet(2);
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplFixedArray::offsetSet() expects exactly 2 parameters, 1 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+SPL FixedArray offsetUnset throws error on no parameter
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$a = $array->offsetUnset();
+if(is_null($a)) {
+ echo 'PASS';
+}
+?>
+--EXPECTF--
+Warning: SplFixedArray::offsetUnset() expects exactly 1 parameter, 0 given in %s on line %d
+PASS
--- /dev/null
+--TEST--
+Check removing an item from an array when the offset is not an integer.
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a fixed array
+ $fixedArray = new SplFixedArray(5);
+
+ // Fill it up
+ for ($i=0; $i < 5; $i++) {
+ $fixedArray[$i] = "PHPNW Testfest";
+ }
+
+ // remove an item
+ $fixedArray->offsetUnset("4");
+
+ var_dump($fixedArray);
+
+?>
+--EXPECTF--
+object(SplFixedArray)#1 (5) {
+ [0]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [1]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [2]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [3]=>
+ %string|unicode%(14) "PHPNW Testfest"
+ [4]=>
+ NULL
+}
--- /dev/null
+--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
--- /dev/null
+--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
--- /dev/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
+}
--- /dev/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
+}
--- /dev/null
+--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) {
+}
--- /dev/null
+--TEST--
+SPL FixedArray can reduce size of array
+--CREDITS--
+PHPNW TestFest 2009 - Ben Longden
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$array[0] = 'a';
+$array[1] = 'b';
+$array[2] = 'c';
+$array[3] = 'd';
+$array[4] = 'e';
+$array->setSize(3);
+print_r($array);
+?>
+--EXPECT--
+SplFixedArray Object
+(
+ [0] => a
+ [1] => b
+ [2] => c
+)
--- /dev/null
+--TEST--
+SPL: FixedArray: setsize - populate array, then shrink
+--CREDITS--
+PHPNW TestFest2009 - Rowan Merewood <rowan@merewood.org>
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$array[0] = 'one';
+$array[1] = 'two';
+$array[2] = 'three';
+$array[3] = 'four';
+$array[4] = 'five';
+$array->setSize(2);
+var_dump($array);
+?>
+--EXPECTF--
+object(SplFixedArray)#1 (2) {
+ [0]=>
+ %string|unicode%(3) "one"
+ [1]=>
+ %string|unicode%(3) "two"
+}
--- /dev/null
+--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
--- /dev/null
+--TEST--
+shrink a full array of integers
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+$array = new SplFixedArray(5);
+$array[0] = 1;
+$array[1] = 1;
+$array[2] = 1;
+$array[3] = 1;
+$array[4] = 1;
+
+$array->setSize(4);
+var_dump($array);
+
+?>
+--EXPECT--
+object(SplFixedArray)#1 (4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(1)
+ [2]=>
+ int(1)
+ [3]=>
+ int(1)
+}
--- /dev/null
+--TEST--
+Check that passing a parameter to toArray() produces a correct error
+--CREDITS--
+PHPNW Testfest 2009 - Paul Court ( g@rgoyle.com )
+--FILE--
+<?php
+ // Create a fixed array
+ $fixedArray = new SplFixedArray(5);
+
+ // Fill it up
+ for ($i=0; $i < 5; $i++) {
+ $fixedArray[$i] = "PHPNW Testfest";
+ }
+
+ // Test count() returns correct error when parameters are passed.
+ $fixedArray->count(1);
+?>
+--EXPECTF--
+Warning: SplFixedArray::count() expects exactly 0 parameters, %d given in %s on line %d
--- /dev/null
+--TEST--
+Checks that offsetExists() does not accept a value larger than the array.
+--CREDITS--
+ PHPNW Test Fest 2009 - Rick Ogden
+--FILE--
+<?php
+$ar = new SplFixedArray(3);
+$ar[0] = 1;
+$ar[1] = 2;
+$ar[2] = 3;
+
+var_dump($ar->offsetExists(4));
+?>
+--EXPECT--
+bool(false)
--- /dev/null
+--TEST--
+Check that SplHeap::count generate a warning and returns NULL when param passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ new stdClass,
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $h = new SplMaxHeap();
+
+ var_dump($h->count($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::count() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplHeap::extract generate a warning and returns NULL when param passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ new stdClass,
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $h = new SplMaxHeap();
+
+ var_dump($h->extract($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplHeap::insert generate a warning and returns NULL when $value is missing
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$h = new SplMaxHeap();
+
+var_dump($h->insert());
+
+?>
+--EXPECTF--
+Warning: SplHeap::insert() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplHeap::isEmpty standard success test
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$h = new SplMaxHeap();
+
+var_dump($h->isEmpty());
+
+?>
+--EXPECTF--
+bool(true)
+
--- /dev/null
+--TEST--
+Check that SplHeap::isEmpty generate a warning and returns NULL when param passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ new stdClass,
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $h = new SplMaxHeap();
+
+ var_dump($h->isEmpty($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::addAll generate a warning and returns NULL when passed non-object param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ var_dump($s->addAll($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, %unicode_string_optional% given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, integer given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, double given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, null given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::attach generates a warning and returns NULL when bad params are passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+var_dump($s->attach(true));
+var_dump($s->attach(new stdClass, true, true));
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::attach() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::attach() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::contains generate a warning and returns NULL when passed non-object param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ var_dump($s->contains($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, %unicode_string_optional% given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, integer given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, double given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::contains() expects parameter 1 to be object, null given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::current returns NULL when storage is empty
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+var_dump($s->current());
+
+?>
+--EXPECT--
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::detach generate a warning and returns NULL when passed non-object param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ var_dump($s->detach($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, %unicode_string_optional% given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, integer given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, double given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::detach() expects parameter 1 to be object, null given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::getInfo returns NULL when storage is empty
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+var_dump($s->getInfo());
+
+?>
+--EXPECT--
+NULL
+
--- /dev/null
+--TEST--
+Standard success for SplObjectStorage::offsetGet
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+$o1 = new stdClass();
+$s[$o1] = 'some_value';
+
+echo $s->offsetGet($o1);
+
+?>
+--EXPECT--
+some_value
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::offsetGet generate a warning and return NULL when passed non-object param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+ $o1 = new stdClass();
+ $s[$o1] = 'some_value';
+
+ var_dump($s->offsetGet($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, %unicode_string_optional% given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, integer given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, double given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::offsetGet() expects parameter 1 to be object, null given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::offsetGet throws exception when non-existing object is requested
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+$o1 = new stdClass();
+
+try {
+ $s->offsetGet($o1);
+} catch (UnexpectedValueException $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Object not found
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::removeAll generate a warning and returns NULL when passed non-object param
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ var_dump($s->removeAll($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, boolean given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, %unicode_string_optional% given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, integer given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, double given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::removeAll() expects parameter 1 to be SplObjectStorage, null given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::setInfo returns NULL when storage is empty
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+var_dump($s->setInfo('some_value'));
+
+?>
+--EXPECT--
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::setInfo returns NULL when no param is passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+var_dump($s->setInfo());
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::setInfo() expects exactly 1 parameter, 0 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::unserialize returns NULL when non-string param is passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ array(),
+ new stdClass(),
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ var_dump($s->unserialize($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplObjectStorage::unserialize() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+NULL
+
+Warning: SplObjectStorage::unserialize() expects parameter 1 to be %binary_string_optional%, object given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::unserialize throws exception when numeric value passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ 12345,
+ 1.2345,
+ PHP_INT_MAX,
+ 'x:rubbish', // rubbish after the 'x:' prefix
+ 'x:i:2;O:8:"stdClass":0:{},s:5:"value";;m:a:0:{}',
+);
+
+foreach($data_provider as $input) {
+
+ $s = new SplObjectStorage();
+
+ try {
+ $s->unserialize($input);
+ } catch(UnexpectedValueException $e) {
+ echo $e->getMessage() . PHP_EOL;
+ }
+}
+
+?>
+--EXPECTF--
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+Error at offset %d of %d bytes
+
--- /dev/null
+--TEST--
+Check that SplObjectStorage::unserialize throws exception when NULL passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$s = new SplObjectStorage();
+
+try {
+ $s->unserialize(NULL);
+} catch(UnexpectedValueException $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECTF--
+Empty serialized string cannot be empty
+
--- /dev/null
+--TEST--
+Check that SplPriorityQueue::extract generate a warning and returns NULL when param passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$data_provider = array(
+ new stdClass,
+ array(),
+ true,
+ "string",
+ 12345,
+ 1.2345,
+ NULL
+);
+
+foreach($data_provider as $input) {
+
+ $h = new SplPriorityQueue();
+
+ var_dump($h->extract($input));
+}
+
+?>
+--EXPECTF--
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
+Warning: SplPriorityQueue::extract() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplPriorityQueue::insert generate a warning and returns NULL when rubbish params are passed
+--CREDITS--
+PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
+--FILE--
+<?php
+
+$h = new SplPriorityQueue();
+
+var_dump($h->insert(NULL));
+
+?>
+--EXPECTF--
+Warning: SplPriorityQueue::insert() expects exactly 2 parameters, 1 given in %s on line %d
+NULL
+
--- /dev/null
+--TEST--
+Check that SplQueue can't be set to LIFO
+--CREDITS--
+Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
+--FILE--
+<?php
+$queue = new SplQueue();
+try {
+ $queue->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECTF--
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
--- /dev/null
+--TEST--
+SplQueue setIteratorMode to LIFO produces fail condition in try/catch
+--CREDITS--
+PHPNW Test Fest 2009 - Jeremy Coates jeremy@phpnw.org.uk
+--FILE--
+<?php
+
+try {
+
+ $dll = new SplQueue();
+ $dll->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO);
+
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+
+?>
+--EXPECT--
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen
--- /dev/null
+--TEST--
+Check that SplStack can't be set to FIFO
+--CREDITS--
+Rob Knight <themanhimself@robknight.org.uk> PHPNW Test Fest 2009
+--FILE--
+<?php
+$stack = new SplStack();
+try {
+ $stack->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
+?>
+--EXPECTF--
+Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen