]> granicus.if.org Git - php/commitdiff
- New tests (testfest NorthWestUG)
authorFelipe Pena <felipe@php.net>
Sat, 23 May 2009 15:38:18 +0000 (15:38 +0000)
committerFelipe Pena <felipe@php.net>
Sat, 23 May 2009 15:38:18 +0000 (15:38 +0000)
104 files changed:
ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt [new file with mode: 0644]
ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt [new file with mode: 0644]
ext/spl/tests/SplArray_fromArray.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_count.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_current.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_current_empty.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_debug-info.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_getIteratorMode.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_getIteratorMode_error.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_isEmpty_empty-with-parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_lifoMode.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetExists_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetGet_missing_param.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetSet_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetSet_one_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_pop_noParams.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_pop_params.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_push_missing_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublyLinkedList_unshift_missing_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublylinkedlist_offsetunset_first.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublylinkedlist_offsetunset_first002.phpt [new file with mode: 0644]
ext/spl/tests/SplDoublylinkedlist_offsetunset_last.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray__construct_param_array.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray__construct_param_float.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray__construct_param_null.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray__construct_param_string.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_count_checkParams.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_count_param_int.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_current_param.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_001.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_002.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromarray_indexes.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_getSize_pass_param.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_key_param.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_key_setsize.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_next_param.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetExists_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetGet_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetSet_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetSet_one_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetUnset_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_offsetUnset_string.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_rewind_param.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setSize_param_array.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setSize_param_float.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setSize_param_null.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setSize_reduce.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setsize_001.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setsize_grow.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_setsize_shrink.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedArray_toArray_with-params.phpt [new file with mode: 0644]
ext/spl/tests/SplFixedarray_offsetExists_larger.phpt [new file with mode: 0644]
ext/spl/tests/SplHeap_count_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplHeap_extract_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplHeap_insert_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplHeap_isEmpty.phpt [new file with mode: 0644]
ext/spl/tests/SplHeap_isEmpty_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_attach_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_contains_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_current_empty_storage.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_detach_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_getInfo_empty_storage.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_offsetGet.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_removeAll_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_setInfo_empty_storage.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_setInfo_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter1.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt [new file with mode: 0644]
ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt [new file with mode: 0644]
ext/spl/tests/SplPriorityQueue_extract_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplPriorityQueue_insert_invalid_parameter.phpt [new file with mode: 0644]
ext/spl/tests/SplQueue_setIteratorMode.phpt [new file with mode: 0644]
ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt [new file with mode: 0644]
ext/spl/tests/SplStack_setIteratorMode.phpt [new file with mode: 0644]

diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt
new file mode 100644 (file)
index 0000000..ed1f473
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt
new file mode 100644 (file)
index 0000000..b2df8a5
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplArray_fromArray.phpt b/ext/spl/tests/SplArray_fromArray.phpt
new file mode 100644 (file)
index 0000000..1144f5f
--- /dev/null
@@ -0,0 +1,17 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt
new file mode 100644 (file)
index 0000000..36b186d
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt
new file mode 100644 (file)
index 0000000..94312a0
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt
new file mode 100644 (file)
index 0000000..651f1e4
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt
new file mode 100644 (file)
index 0000000..efc6b8a
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_count.phpt b/ext/spl/tests/SplDoublyLinkedList_count.phpt
new file mode 100644 (file)
index 0000000..72b029c
--- /dev/null
@@ -0,0 +1,12 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt b/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt
new file mode 100644 (file)
index 0000000..36c72de
--- /dev/null
@@ -0,0 +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--
+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.phpt b/ext/spl/tests/SplDoublyLinkedList_current.phpt
new file mode 100644 (file)
index 0000000..3e13a6b
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+SplDoublyLinkedList getIteratorMode
+--CREDITS--
+PHPNW Testfest 2009 - Lorna Mitchell
+--FILE--
+<?php
+$list = new SplDoublyLinkedList();
+var_dump($list->current());
+?>
+--EXPECT--
+NULL
diff --git a/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt
new file mode 100644 (file)
index 0000000..558504b
--- /dev/null
@@ -0,0 +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--
+NULL
\ No newline at end of file
diff --git a/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt
new file mode 100644 (file)
index 0000000..3164b42
--- /dev/null
@@ -0,0 +1,29 @@
+--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
+        )
+
+)
diff --git a/ext/spl/tests/SplDoublyLinkedList_getIteratorMode.phpt b/ext/spl/tests/SplDoublyLinkedList_getIteratorMode.phpt
new file mode 100644 (file)
index 0000000..d1bfb46
--- /dev/null
@@ -0,0 +1,12 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_getIteratorMode_error.phpt b/ext/spl/tests/SplDoublyLinkedList_getIteratorMode_error.phpt
new file mode 100644 (file)
index 0000000..cb43bee
--- /dev/null
@@ -0,0 +1,12 @@
+--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
+
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty-with-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty-with-parameter.phpt
new file mode 100644 (file)
index 0000000..8d7aaf8
--- /dev/null
@@ -0,0 +1,14 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt
new file mode 100644 (file)
index 0000000..f129385
--- /dev/null
@@ -0,0 +1,13 @@
+--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)
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.phpt
new file mode 100644 (file)
index 0000000..6ea9198
--- /dev/null
@@ -0,0 +1,20 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt
new file mode 100644 (file)
index 0000000..cac1866
--- /dev/null
@@ -0,0 +1,19 @@
+--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)
diff --git a/ext/spl/tests/SplDoublyLinkedList_lifoMode.phpt b/ext/spl/tests/SplDoublyLinkedList_lifoMode.phpt
new file mode 100644 (file)
index 0000000..86a8456
--- /dev/null
@@ -0,0 +1,23 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetExists_invalid_parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetExists_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..f0e1b8b
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt
new file mode 100644 (file)
index 0000000..0399b49
--- /dev/null
@@ -0,0 +1,31 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt
new file mode 100644 (file)
index 0000000..36c47fe
--- /dev/null
@@ -0,0 +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--
+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_missing_param.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_missing_param.phpt
new file mode 100644 (file)
index 0000000..beffe7a
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt
new file mode 100644 (file)
index 0000000..5df4ab5
--- /dev/null
@@ -0,0 +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}
+  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
new file mode 100644 (file)
index 0000000..fcff762
--- /dev/null
@@ -0,0 +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}
+  thrown in %s on line %d
\ No newline at end of file
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetSet_invalid_parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetSet_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..2447e79
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetSet_one_invalid_parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetSet_one_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..244dcd5
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt
new file mode 100644 (file)
index 0000000..687fcad
--- /dev/null
@@ -0,0 +1,27 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt
new file mode 100644 (file)
index 0000000..d3d1d7d
--- /dev/null
@@ -0,0 +1,23 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt
new file mode 100644 (file)
index 0000000..aea73b9
--- /dev/null
@@ -0,0 +1,23 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_pop_noParams.phpt b/ext/spl/tests/SplDoublyLinkedList_pop_noParams.phpt
new file mode 100644 (file)
index 0000000..64f3a48
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt b/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt
new file mode 100644 (file)
index 0000000..11ab343
--- /dev/null
@@ -0,0 +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--
+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_push_missing_parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_push_missing_parameter.phpt
new file mode 100644 (file)
index 0000000..057751c
--- /dev/null
@@ -0,0 +1,13 @@
+--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
+
diff --git a/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt b/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt
new file mode 100644 (file)
index 0000000..9bf7a32
--- /dev/null
@@ -0,0 +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--
+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_shift_noParams.phpt b/ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt
new file mode 100644 (file)
index 0000000..cd4ea5b
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt
new file mode 100644 (file)
index 0000000..2e2632d
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt
new file mode 100644 (file)
index 0000000..0a481b8
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt
new file mode 100644 (file)
index 0000000..72bdbab
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt b/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt
new file mode 100644 (file)
index 0000000..6a92399
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplDoublyLinkedList_unshift_missing_parameter.phpt b/ext/spl/tests/SplDoublyLinkedList_unshift_missing_parameter.phpt
new file mode 100644 (file)
index 0000000..18afa03
--- /dev/null
@@ -0,0 +1,13 @@
+--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
+
diff --git a/ext/spl/tests/SplDoublylinkedlist_offsetunset_first.phpt b/ext/spl/tests/SplDoublylinkedlist_offsetunset_first.phpt
new file mode 100644 (file)
index 0000000..4dce4db
--- /dev/null
@@ -0,0 +1,25 @@
+--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"
+  }
+}
diff --git a/ext/spl/tests/SplDoublylinkedlist_offsetunset_first002.phpt b/ext/spl/tests/SplDoublylinkedlist_offsetunset_first002.phpt
new file mode 100644 (file)
index 0000000..a42e6f9
--- /dev/null
@@ -0,0 +1,17 @@
+--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
diff --git a/ext/spl/tests/SplDoublylinkedlist_offsetunset_last.phpt b/ext/spl/tests/SplDoublylinkedlist_offsetunset_last.phpt
new file mode 100644 (file)
index 0000000..0f5dac1
--- /dev/null
@@ -0,0 +1,25 @@
+--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"
+  }
+}
diff --git a/ext/spl/tests/SplFixedArray__construct_param_array.phpt b/ext/spl/tests/SplFixedArray__construct_param_array.phpt
new file mode 100644 (file)
index 0000000..d63d7cc
--- /dev/null
@@ -0,0 +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--
+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
new file mode 100644 (file)
index 0000000..670a109
--- /dev/null
@@ -0,0 +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--
+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
new file mode 100644 (file)
index 0000000..3b1543d
--- /dev/null
@@ -0,0 +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
+(
+)
\ 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
new file mode 100644 (file)
index 0000000..3a7e734
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt
new file mode 100644 (file)
index 0000000..6582f84
--- /dev/null
@@ -0,0 +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) {
+}
\ No newline at end of file
diff --git a/ext/spl/tests/SplFixedArray_count_checkParams.phpt b/ext/spl/tests/SplFixedArray_count_checkParams.phpt
new file mode 100644 (file)
index 0000000..5cbe2e8
--- /dev/null
@@ -0,0 +1,16 @@
+--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
+
diff --git a/ext/spl/tests/SplFixedArray_count_param_int.phpt b/ext/spl/tests/SplFixedArray_count_param_int.phpt
new file mode 100644 (file)
index 0000000..108bb2d
--- /dev/null
@@ -0,0 +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--
+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
new file mode 100644 (file)
index 0000000..71f5d3a
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_001.phpt b/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_001.phpt
new file mode 100644 (file)
index 0000000..36ecf46
--- /dev/null
@@ -0,0 +1,10 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_002.phpt b/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_002.phpt
new file mode 100644 (file)
index 0000000..ba81428
--- /dev/null
@@ -0,0 +1,10 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt
new file mode 100644 (file)
index 0000000..034d457
--- /dev/null
@@ -0,0 +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)
+}
diff --git a/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt
new file mode 100644 (file)
index 0000000..ecae2ab
--- /dev/null
@@ -0,0 +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)
+}
diff --git a/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt b/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt
new file mode 100644 (file)
index 0000000..80d9669
--- /dev/null
@@ -0,0 +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--
+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
new file mode 100644 (file)
index 0000000..f57fe78
--- /dev/null
@@ -0,0 +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"
+  }
+}
diff --git a/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt b/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt
new file mode 100644 (file)
index 0000000..ef4f40c
--- /dev/null
@@ -0,0 +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*
diff --git a/ext/spl/tests/SplFixedArray_key_param.phpt b/ext/spl/tests/SplFixedArray_key_param.phpt
new file mode 100644 (file)
index 0000000..300e6df
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplFixedArray_key_setsize.phpt b/ext/spl/tests/SplFixedArray_key_setsize.phpt
new file mode 100644 (file)
index 0000000..97e4811
--- /dev/null
@@ -0,0 +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--
+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
new file mode 100644 (file)
index 0000000..5e8cb63
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplFixedArray_offsetExists_invalid_parameter.phpt b/ext/spl/tests/SplFixedArray_offsetExists_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..76ee2f5
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt
new file mode 100644 (file)
index 0000000..9bfda34
--- /dev/null
@@ -0,0 +1,13 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetGet_invalid_parameter.phpt b/ext/spl/tests/SplFixedArray_offsetGet_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..71a1bf8
--- /dev/null
@@ -0,0 +1,16 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetSet_invalid_parameter.phpt b/ext/spl/tests/SplFixedArray_offsetSet_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..4e43a52
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetSet_one_invalid_parameter.phpt b/ext/spl/tests/SplFixedArray_offsetSet_one_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..c19cd01
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetUnset_invalid_parameter.phpt b/ext/spl/tests/SplFixedArray_offsetUnset_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..40a372b
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt
new file mode 100644 (file)
index 0000000..21976b5
--- /dev/null
@@ -0,0 +1,33 @@
+--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
+}
diff --git a/ext/spl/tests/SplFixedArray_rewind_param.phpt b/ext/spl/tests/SplFixedArray_rewind_param.phpt
new file mode 100644 (file)
index 0000000..7002efb
--- /dev/null
@@ -0,0 +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
diff --git a/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt b/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt
new file mode 100644 (file)
index 0000000..a460747
--- /dev/null
@@ -0,0 +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)
+}
\ 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
new file mode 100644 (file)
index 0000000..269a45d
--- /dev/null
@@ -0,0 +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
+}
diff --git a/ext/spl/tests/SplFixedArray_setSize_param_float.phpt b/ext/spl/tests/SplFixedArray_setSize_param_float.phpt
new file mode 100644 (file)
index 0000000..c65686c
--- /dev/null
@@ -0,0 +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
+}
diff --git a/ext/spl/tests/SplFixedArray_setSize_param_null.phpt b/ext/spl/tests/SplFixedArray_setSize_param_null.phpt
new file mode 100644 (file)
index 0000000..ddb37be
--- /dev/null
@@ -0,0 +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) {
+}
diff --git a/ext/spl/tests/SplFixedArray_setSize_reduce.phpt b/ext/spl/tests/SplFixedArray_setSize_reduce.phpt
new file mode 100644 (file)
index 0000000..eb8e1d9
--- /dev/null
@@ -0,0 +1,22 @@
+--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
+)
diff --git a/ext/spl/tests/SplFixedArray_setsize_001.phpt b/ext/spl/tests/SplFixedArray_setsize_001.phpt
new file mode 100644 (file)
index 0000000..925912c
--- /dev/null
@@ -0,0 +1,22 @@
+--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"
+}
diff --git a/ext/spl/tests/SplFixedArray_setsize_grow.phpt b/ext/spl/tests/SplFixedArray_setsize_grow.phpt
new file mode 100644 (file)
index 0000000..418d1ac
--- /dev/null
@@ -0,0 +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
+)
\ No newline at end of file
diff --git a/ext/spl/tests/SplFixedArray_setsize_shrink.phpt b/ext/spl/tests/SplFixedArray_setsize_shrink.phpt
new file mode 100644 (file)
index 0000000..2130cf8
--- /dev/null
@@ -0,0 +1,28 @@
+--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)
+}
diff --git a/ext/spl/tests/SplFixedArray_toArray_with-params.phpt b/ext/spl/tests/SplFixedArray_toArray_with-params.phpt
new file mode 100644 (file)
index 0000000..8864362
--- /dev/null
@@ -0,0 +1,19 @@
+--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
diff --git a/ext/spl/tests/SplFixedarray_offsetExists_larger.phpt b/ext/spl/tests/SplFixedarray_offsetExists_larger.phpt
new file mode 100644 (file)
index 0000000..9449d64
--- /dev/null
@@ -0,0 +1,15 @@
+--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)
diff --git a/ext/spl/tests/SplHeap_count_invalid_parameter.phpt b/ext/spl/tests/SplHeap_count_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..727790e
--- /dev/null
@@ -0,0 +1,47 @@
+--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
+
diff --git a/ext/spl/tests/SplHeap_extract_invalid_parameter.phpt b/ext/spl/tests/SplHeap_extract_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..ba03976
--- /dev/null
@@ -0,0 +1,47 @@
+--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
+
diff --git a/ext/spl/tests/SplHeap_insert_invalid_parameter.phpt b/ext/spl/tests/SplHeap_insert_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..86c6b63
--- /dev/null
@@ -0,0 +1,16 @@
+--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
+
diff --git a/ext/spl/tests/SplHeap_isEmpty.phpt b/ext/spl/tests/SplHeap_isEmpty.phpt
new file mode 100644 (file)
index 0000000..e179dbc
--- /dev/null
@@ -0,0 +1,15 @@
+--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)
+
diff --git a/ext/spl/tests/SplHeap_isEmpty_invalid_parameter.phpt b/ext/spl/tests/SplHeap_isEmpty_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..021aff4
--- /dev/null
@@ -0,0 +1,47 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..62605b1
--- /dev/null
@@ -0,0 +1,43 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_attach_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_attach_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..d984429
--- /dev/null
@@ -0,0 +1,20 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_contains_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_contains_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..f523928
--- /dev/null
@@ -0,0 +1,43 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_current_empty_storage.phpt b/ext/spl/tests/SplObjectStorage_current_empty_storage.phpt
new file mode 100644 (file)
index 0000000..65fa691
--- /dev/null
@@ -0,0 +1,15 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_detach_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_detach_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..83b79fc
--- /dev/null
@@ -0,0 +1,43 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_getInfo_empty_storage.phpt b/ext/spl/tests/SplObjectStorage_getInfo_empty_storage.phpt
new file mode 100644 (file)
index 0000000..e6c4de8
--- /dev/null
@@ -0,0 +1,15 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_offsetGet.phpt b/ext/spl/tests/SplObjectStorage_offsetGet.phpt
new file mode 100644 (file)
index 0000000..e73f6b1
--- /dev/null
@@ -0,0 +1,17 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..3f8bd43
--- /dev/null
@@ -0,0 +1,45 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt
new file mode 100644 (file)
index 0000000..72b032c
--- /dev/null
@@ -0,0 +1,20 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_removeAll_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_removeAll_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..ffd3398
--- /dev/null
@@ -0,0 +1,43 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_setInfo_empty_storage.phpt b/ext/spl/tests/SplObjectStorage_setInfo_empty_storage.phpt
new file mode 100644 (file)
index 0000000..c8c3cd1
--- /dev/null
@@ -0,0 +1,15 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_setInfo_invalid_parameter.phpt b/ext/spl/tests/SplObjectStorage_setInfo_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..52f8f9b
--- /dev/null
@@ -0,0 +1,16 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter1.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter1.phpt
new file mode 100644 (file)
index 0000000..dcf43e2
--- /dev/null
@@ -0,0 +1,27 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt
new file mode 100644 (file)
index 0000000..be2bb33
--- /dev/null
@@ -0,0 +1,34 @@
+--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
+
diff --git a/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt
new file mode 100644 (file)
index 0000000..4c2dd75
--- /dev/null
@@ -0,0 +1,19 @@
+--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
+
diff --git a/ext/spl/tests/SplPriorityQueue_extract_invalid_parameter.phpt b/ext/spl/tests/SplPriorityQueue_extract_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..7dda782
--- /dev/null
@@ -0,0 +1,47 @@
+--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
+
diff --git a/ext/spl/tests/SplPriorityQueue_insert_invalid_parameter.phpt b/ext/spl/tests/SplPriorityQueue_insert_invalid_parameter.phpt
new file mode 100644 (file)
index 0000000..7d7b589
--- /dev/null
@@ -0,0 +1,16 @@
+--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
+
diff --git a/ext/spl/tests/SplQueue_setIteratorMode.phpt b/ext/spl/tests/SplQueue_setIteratorMode.phpt
new file mode 100644 (file)
index 0000000..172a1d9
--- /dev/null
@@ -0,0 +1,15 @@
+--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
diff --git a/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt
new file mode 100644 (file)
index 0000000..c3071f2
--- /dev/null
@@ -0,0 +1,19 @@
+--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
diff --git a/ext/spl/tests/SplStack_setIteratorMode.phpt b/ext/spl/tests/SplStack_setIteratorMode.phpt
new file mode 100644 (file)
index 0000000..d70105e
--- /dev/null
@@ -0,0 +1,15 @@
+--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