From 9708b01654f277c633f40161d8ea57f00b577d99 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 23 May 2009 15:37:36 +0000 Subject: [PATCH] - New tests (testfest NorthWestUG) --- ...ectoryIterator_getBasename_basic_test.phpt | 23 +++++++++ ...ectoryIterator_getBasename_pass_array.phpt | 23 +++++++++ ext/spl/tests/SplArray_fromArray.phpt | 17 +++++++ ...SplDoublyLinkedList_bottom_pass_array.phpt | 14 ++++++ ...SplDoublyLinkedList_bottom_pass_float.phpt | 14 ++++++ ...lDoublyLinkedList_bottom_pass_integer.phpt | 14 ++++++ .../SplDoublyLinkedList_bottom_pass_null.phpt | 14 ++++++ ext/spl/tests/SplDoublyLinkedList_count.phpt | 12 +++++ ...dList_count_param_SplDoublyLinkedList.phpt | 11 +++++ .../tests/SplDoublyLinkedList_current.phpt | 11 +++++ .../SplDoublyLinkedList_current_empty.phpt | 13 +++++ .../tests/SplDoublyLinkedList_debug-info.phpt | 29 ++++++++++++ .../SplDoublyLinkedList_getIteratorMode.phpt | 12 +++++ ...oublyLinkedList_getIteratorMode_error.phpt | 12 +++++ ...nkedList_isEmpty_empty-with-parameter.phpt | 14 ++++++ .../SplDoublyLinkedList_isEmpty_empty.phpt | 13 +++++ ...List_isEmpty_not-empty-with-parameter.phpt | 20 ++++++++ ...SplDoublyLinkedList_isEmpty_not-empty.phpt | 19 ++++++++ .../tests/SplDoublyLinkedList_lifoMode.phpt | 23 +++++++++ ...edList_offsetExists_invalid_parameter.phpt | 15 ++++++ ...DoublyLinkedList_offsetExists_success.phpt | 31 ++++++++++++ .../SplDoublyLinkedList_offsetGet_empty.phpt | 14 ++++++ ...blyLinkedList_offsetGet_missing_param.phpt | 15 ++++++ ...oublyLinkedList_offsetGet_param_array.phpt | 18 +++++++ ...ublyLinkedList_offsetGet_param_string.phpt | 18 +++++++ ...inkedList_offsetSet_invalid_parameter.phpt | 15 ++++++ ...dList_offsetSet_one_invalid_parameter.phpt | 15 ++++++ ...ist_offsetUnset_greater_than_elements.phpt | 27 +++++++++++ ...edList_offsetUnset_negative-parameter.phpt | 23 +++++++++ ...etUnset_parameter-larger-num-elements.phpt | 23 +++++++++ .../SplDoublyLinkedList_pop_noParams.phpt | 15 ++++++ .../tests/SplDoublyLinkedList_pop_params.phpt | 14 ++++++ ...ublyLinkedList_push_missing_parameter.phpt | 13 +++++ ...teratorMode_param_SplDoublyLinkedList.phpt | 11 +++++ .../SplDoublyLinkedList_shift_noParams.phpt | 15 ++++++ .../SplDoublyLinkedList_top_pass_array.phpt | 14 ++++++ .../SplDoublyLinkedList_top_pass_float.phpt | 14 ++++++ .../SplDoublyLinkedList_top_pass_integer.phpt | 14 ++++++ .../SplDoublyLinkedList_top_pass_null.phpt | 14 ++++++ ...yLinkedList_unshift_missing_parameter.phpt | 13 +++++ ...SplDoublylinkedlist_offsetunset_first.phpt | 25 ++++++++++ ...Doublylinkedlist_offsetunset_first002.phpt | 17 +++++++ .../SplDoublylinkedlist_offsetunset_last.phpt | 25 ++++++++++ .../SplFixedArray__construct_param_array.phpt | 12 +++++ .../SplFixedArray__construct_param_float.phpt | 14 ++++++ .../SplFixedArray__construct_param_null.phpt | 16 +++++++ ...SplFixedArray__construct_param_string.phpt | 12 +++++ ...edArray_construct_param_SplFixedArray.phpt | 13 +++++ .../SplFixedArray_count_checkParams.phpt | 16 +++++++ .../tests/SplFixedArray_count_param_int.phpt | 11 +++++ .../tests/SplFixedArray_current_param.phpt | 24 ++++++++++ ...Array_fromArray_invalid_parameter_001.phpt | 10 ++++ ...Array_fromArray_invalid_parameter_002.phpt | 10 ++++ .../SplFixedArray_fromarray_indexes.phpt | 22 +++++++++ .../SplFixedArray_fromarray_non_indexes.phpt | 21 +++++++++ ...SplFixedArray_fromarray_param_boolean.phpt | 10 ++++ ...FixedArray_fromarray_param_multiarray.phpt | 17 +++++++ .../SplFixedArray_getSize_pass_param.phpt | 12 +++++ ext/spl/tests/SplFixedArray_key_param.phpt | 24 ++++++++++ ext/spl/tests/SplFixedArray_key_setsize.phpt | 20 ++++++++ ext/spl/tests/SplFixedArray_next_param.phpt | 18 +++++++ ...dArray_offsetExists_invalid_parameter.phpt | 15 ++++++ ...ixedArray_offsetExists_less_than_zero.phpt | 13 +++++ ...ixedArray_offsetGet_invalid_parameter.phpt | 16 +++++++ ...ixedArray_offsetSet_invalid_parameter.phpt | 15 ++++++ ...Array_offsetSet_one_invalid_parameter.phpt | 15 ++++++ ...edArray_offsetUnset_invalid_parameter.phpt | 15 ++++++ .../SplFixedArray_offsetUnset_string.phpt | 33 +++++++++++++ ext/spl/tests/SplFixedArray_rewind_param.phpt | 18 +++++++ ...lFixedArray_setSize_filled_to_smaller.phpt | 22 +++++++++ .../SplFixedArray_setSize_param_array.phpt | 18 +++++++ .../SplFixedArray_setSize_param_float.phpt | 19 ++++++++ .../SplFixedArray_setSize_param_null.phpt | 13 +++++ .../tests/SplFixedArray_setSize_reduce.phpt | 22 +++++++++ ext/spl/tests/SplFixedArray_setsize_001.phpt | 22 +++++++++ ext/spl/tests/SplFixedArray_setsize_grow.phpt | 30 ++++++++++++ .../tests/SplFixedArray_setsize_shrink.phpt | 28 +++++++++++ .../SplFixedArray_toArray_with-params.phpt | 19 ++++++++ .../SplFixedarray_offsetExists_larger.phpt | 15 ++++++ .../SplHeap_count_invalid_parameter.phpt | 47 +++++++++++++++++++ .../SplHeap_extract_invalid_parameter.phpt | 47 +++++++++++++++++++ .../SplHeap_insert_invalid_parameter.phpt | 16 +++++++ ext/spl/tests/SplHeap_isEmpty.phpt | 15 ++++++ .../SplHeap_isEmpty_invalid_parameter.phpt | 47 +++++++++++++++++++ ...bjectStorage_addAll_invalid_parameter.phpt | 43 +++++++++++++++++ ...bjectStorage_attach_invalid_parameter.phpt | 20 ++++++++ ...ectStorage_contains_invalid_parameter.phpt | 43 +++++++++++++++++ ...plObjectStorage_current_empty_storage.phpt | 15 ++++++ ...bjectStorage_detach_invalid_parameter.phpt | 43 +++++++++++++++++ ...plObjectStorage_getInfo_empty_storage.phpt | 15 ++++++ ext/spl/tests/SplObjectStorage_offsetGet.phpt | 17 +++++++ ...ctStorage_offsetGet_invalid_parameter.phpt | 45 ++++++++++++++++++ ...bjectStorage_offsetGet_missing_object.phpt | 20 ++++++++ ...ctStorage_removeAll_invalid_parameter.phpt | 43 +++++++++++++++++ ...plObjectStorage_setInfo_empty_storage.phpt | 15 ++++++ ...jectStorage_setInfo_invalid_parameter.phpt | 16 +++++++ ...torage_unserialize_invalid_parameter1.phpt | 27 +++++++++++ ...torage_unserialize_invalid_parameter2.phpt | 34 ++++++++++++++ ...torage_unserialize_invalid_parameter3.phpt | 19 ++++++++ ...iorityQueue_extract_invalid_parameter.phpt | 47 +++++++++++++++++++ ...riorityQueue_insert_invalid_parameter.phpt | 16 +++++++ ext/spl/tests/SplQueue_setIteratorMode.phpt | 15 ++++++ .../SplQueue_setIteratorMode_param_lifo.phpt | 19 ++++++++ ext/spl/tests/SplStack_setIteratorMode.phpt | 15 ++++++ 104 files changed, 2055 insertions(+) create mode 100644 ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt create mode 100644 ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt create mode 100644 ext/spl/tests/SplArray_fromArray.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_count.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_current.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_current_empty.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_debug-info.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_getIteratorMode.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_getIteratorMode_error.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_isEmpty_empty-with-parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_lifoMode.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetExists_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetGet_missing_param.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetSet_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetSet_one_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_pop_noParams.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_pop_params.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_push_missing_parameter.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt create mode 100644 ext/spl/tests/SplDoublyLinkedList_unshift_missing_parameter.phpt create mode 100644 ext/spl/tests/SplDoublylinkedlist_offsetunset_first.phpt create mode 100644 ext/spl/tests/SplDoublylinkedlist_offsetunset_first002.phpt create mode 100644 ext/spl/tests/SplDoublylinkedlist_offsetunset_last.phpt create mode 100644 ext/spl/tests/SplFixedArray__construct_param_array.phpt create mode 100644 ext/spl/tests/SplFixedArray__construct_param_float.phpt create mode 100644 ext/spl/tests/SplFixedArray__construct_param_null.phpt create mode 100644 ext/spl/tests/SplFixedArray__construct_param_string.phpt create mode 100644 ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt create mode 100644 ext/spl/tests/SplFixedArray_count_checkParams.phpt create mode 100644 ext/spl/tests/SplFixedArray_count_param_int.phpt create mode 100644 ext/spl/tests/SplFixedArray_current_param.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_001.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_002.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromarray_indexes.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt create mode 100644 ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt create mode 100644 ext/spl/tests/SplFixedArray_getSize_pass_param.phpt create mode 100644 ext/spl/tests/SplFixedArray_key_param.phpt create mode 100644 ext/spl/tests/SplFixedArray_key_setsize.phpt create mode 100644 ext/spl/tests/SplFixedArray_next_param.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetExists_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetGet_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetSet_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetSet_one_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetUnset_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplFixedArray_offsetUnset_string.phpt create mode 100644 ext/spl/tests/SplFixedArray_rewind_param.phpt create mode 100644 ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt create mode 100644 ext/spl/tests/SplFixedArray_setSize_param_array.phpt create mode 100644 ext/spl/tests/SplFixedArray_setSize_param_float.phpt create mode 100644 ext/spl/tests/SplFixedArray_setSize_param_null.phpt create mode 100644 ext/spl/tests/SplFixedArray_setSize_reduce.phpt create mode 100644 ext/spl/tests/SplFixedArray_setsize_001.phpt create mode 100644 ext/spl/tests/SplFixedArray_setsize_grow.phpt create mode 100644 ext/spl/tests/SplFixedArray_setsize_shrink.phpt create mode 100644 ext/spl/tests/SplFixedArray_toArray_with-params.phpt create mode 100644 ext/spl/tests/SplFixedarray_offsetExists_larger.phpt create mode 100644 ext/spl/tests/SplHeap_count_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplHeap_extract_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplHeap_insert_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplHeap_isEmpty.phpt create mode 100644 ext/spl/tests/SplHeap_isEmpty_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_attach_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_contains_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_current_empty_storage.phpt create mode 100644 ext/spl/tests/SplObjectStorage_detach_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_getInfo_empty_storage.phpt create mode 100644 ext/spl/tests/SplObjectStorage_offsetGet.phpt create mode 100644 ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt create mode 100644 ext/spl/tests/SplObjectStorage_removeAll_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_setInfo_empty_storage.phpt create mode 100644 ext/spl/tests/SplObjectStorage_setInfo_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter1.phpt create mode 100644 ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt create mode 100644 ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt create mode 100644 ext/spl/tests/SplPriorityQueue_extract_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplPriorityQueue_insert_invalid_parameter.phpt create mode 100644 ext/spl/tests/SplQueue_setIteratorMode.phpt create mode 100644 ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt create mode 100644 ext/spl/tests/SplStack_setIteratorMode.phpt diff --git a/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt new file mode 100644 index 0000000000..ed1f473be9 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getBasename_basic_test.phpt @@ -0,0 +1,23 @@ +--TEST-- +DirectoryIterator::getBasename() - Basic Test +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +isFile()) { + $dir->next(); + } + echo $dir->getBasename('.txt'); +?> +--CLEAN-- + +--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 index 0000000000..b2df8a55c9 --- /dev/null +++ b/ext/spl/tests/DirectoryIterator_getBasename_pass_array.phpt @@ -0,0 +1,23 @@ +--TEST-- +DirectoryIterator::getBasename() - Pass unexpected array +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +isFile()) { + $dir->next(); + } + echo $dir->getBasename(array()); +?> +--CLEAN-- + +--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 index 0000000000..1144f5f8dc --- /dev/null +++ b/ext/spl/tests/SplArray_fromArray.phpt @@ -0,0 +1,17 @@ +--TEST-- +Check that SplArray::fromArray will not allow integer overflows +--CREDITS-- +Rob Knight PHPNW Test Fest 2009 +--FILE-- + '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 index 0000000000..36b186d6b7 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_array.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected array parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..94312a0f60 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_float.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected float parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..651f1e4382 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_integer.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected integer parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..efc6b8ae50 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_bottom_pass_null.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::bottom() - pass in an unexpected null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..72b029cce4 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_count.phpt @@ -0,0 +1,12 @@ +--TEST-- +Check that SplDoublyLinkedList::count fails if parameter passed in +--CREDITS-- +Rob Knight PHPNW Test Fest 2009 +--FILE-- +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 index 0000000000..36c72de191 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_count_param_SplDoublyLinkedList.phpt @@ -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-- +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 index 0000000000..3e13a6b7f9 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_current.phpt @@ -0,0 +1,11 @@ +--TEST-- +SplDoublyLinkedList getIteratorMode +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- +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 index 0000000000..558504b38b --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_current_empty.phpt @@ -0,0 +1,13 @@ +--TEST-- +Run current() function on an empty SplDoublyLinkedList. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +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 index 0000000000..3164b42206 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_debug-info.phpt @@ -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-- +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 index 0000000000..d1bfb46de3 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_getIteratorMode.phpt @@ -0,0 +1,12 @@ +--TEST-- +SplDoublyLinkedList getIteratorMode +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- +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 index 0000000000..cb43bee1ce --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_getIteratorMode_error.phpt @@ -0,0 +1,12 @@ +--TEST-- +SplDoublyLinkedList getIteratorMode with an unexpected parameter +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- +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 index 0000000000..8d7aaf8c93 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty-with-parameter.phpt @@ -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-- +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 index 0000000000..f129385d07 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_empty.phpt @@ -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-- +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 index 0000000000..6ea9198bf0 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty-with-parameter.phpt @@ -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-- +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 index 0000000000..cac1866bc1 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_isEmpty_not-empty.phpt @@ -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-- +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 index 0000000000..86a84567a8 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_lifoMode.phpt @@ -0,0 +1,23 @@ +--TEST-- +Check that SplDoublyLinkedList can traverse backwards +--CREDITS-- +Rob Knight PHPNW Test Fest 2009 +--FILE-- +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 index 0000000000..f0e1b8ba14 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetExists_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL SplDoublyLinkedList offsetExists displays warning and returns null on no parameters +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..0399b4948d --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetExists_success.phpt @@ -0,0 +1,31 @@ +--TEST-- +SPL SplDoublyLinkedList offsetExists returns correct values +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..36c47fef2e --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_empty.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::offsetGet() with no parameter passed. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..beffe7ad87 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_missing_param.phpt @@ -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-- +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 index 0000000000..5df4ab59a5 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_array.phpt @@ -0,0 +1,18 @@ +--TEST-- +SplDoublyLinkedList::offsetGet() with 1st parameter passed as array. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..fcff762e6b --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetGet_param_string.phpt @@ -0,0 +1,18 @@ +--TEST-- +SplDoublyLinkedList::offsetGet() with 1st parameter passed as string. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..2447e798a1 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetSet_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SplDoublyLinkedList offsetSet throws error on no parameters +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..244dcd5b03 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetSet_one_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SplDoublyLinkedList offsetSet throws error only one parameter +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..687fcad78c --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_greater_than_elements.phpt @@ -0,0 +1,27 @@ +--TEST-- +Doubly Linked List - offsetUnset > number elements + +--CREDITS-- +PHPNW Test Fest 2009 - Mat Griffin + +--FILE-- +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 index 0000000000..d3d1d7d9a9 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_negative-parameter.phpt @@ -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-- +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 index 0000000000..aea73b93b4 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_offsetUnset_parameter-larger-num-elements.phpt @@ -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-- +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 index 0000000000..64f3a48150 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_pop_noParams.phpt @@ -0,0 +1,15 @@ +--TEST-- +Checks that the pop() method of DoublyLinkedList does not accept args. +--CREDITS-- +PHPNW Test Fest 2009 - Rick Ogden +--FILE-- +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 index 0000000000..11ab343dbe --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_pop_params.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::offsetGet() with no parameter passed. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..057751c2eb --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_push_missing_parameter.phpt @@ -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-- +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 index 0000000000..9bf7a32007 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_setIteratorMode_param_SplDoublyLinkedList.phpt @@ -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-- +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 index 0000000000..cd4ea5b033 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_shift_noParams.phpt @@ -0,0 +1,15 @@ +--TEST-- +Checks that the shift() method of DoublyLinkedList does not accept args. +--CREDITS-- +PHPNW Test Fest 2009 - Rick Ogden +--FILE-- +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 index 0000000000..2e2632d39a --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_array.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected array +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..0a481b85a0 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_float.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected float parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..72bdbabc3d --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_integer.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected integer parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..6a92399739 --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_top_pass_null.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplDoublyLinkedList::top() - pass in an unexpected null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..18afa034bb --- /dev/null +++ b/ext/spl/tests/SplDoublyLinkedList_unshift_missing_parameter.phpt @@ -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-- +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 index 0000000000..4dce4db8de --- /dev/null +++ b/ext/spl/tests/SplDoublylinkedlist_offsetunset_first.phpt @@ -0,0 +1,25 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - first element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood +--FILE-- +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 index 0000000000..a42e6f9040 --- /dev/null +++ b/ext/spl/tests/SplDoublylinkedlist_offsetunset_first002.phpt @@ -0,0 +1,17 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - first element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood +--FILE-- +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 index 0000000000..0f5dac19f9 --- /dev/null +++ b/ext/spl/tests/SplDoublylinkedlist_offsetunset_last.phpt @@ -0,0 +1,25 @@ +--TEST-- +SPL: SplDoublyLinkedList : offsetUnset - last element +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood +--FILE-- +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 index 0000000000..d63d7cca54 --- /dev/null +++ b/ext/spl/tests/SplFixedArray__construct_param_array.phpt @@ -0,0 +1,12 @@ +--TEST-- +SplFixedArray::__construct() with array passed as integer. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- + +--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 index 0000000000..670a1095eb --- /dev/null +++ b/ext/spl/tests/SplFixedArray__construct_param_float.phpt @@ -0,0 +1,14 @@ +--TEST-- +SplFixedArray::__construct() with float passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..3b1543d4dc --- /dev/null +++ b/ext/spl/tests/SplFixedArray__construct_param_null.phpt @@ -0,0 +1,16 @@ +--TEST-- +SplFixedArray::__construct() with null passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- + +--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 index 0000000000..3a7e734b06 --- /dev/null +++ b/ext/spl/tests/SplFixedArray__construct_param_string.phpt @@ -0,0 +1,12 @@ +--TEST-- +SplFixedArray::__construct() with string passed as parameter. +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- + +--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 index 0000000000..6582f847bd --- /dev/null +++ b/ext/spl/tests/SplFixedArray_construct_param_SplFixedArray.phpt @@ -0,0 +1,13 @@ +--TEST-- +Create an SplFixedArray using an SplFixedArray object. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- + +--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 index 0000000000..5cbe2e80ce --- /dev/null +++ b/ext/spl/tests/SplFixedArray_count_checkParams.phpt @@ -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-- +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 index 0000000000..108bb2db69 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_count_param_int.phpt @@ -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-- +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 index 0000000000..71f5d3a524 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_current_param.phpt @@ -0,0 +1,24 @@ +--TEST-- +SplFixedArray::current() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..36ecf46453 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_001.phpt @@ -0,0 +1,10 @@ +--TEST-- +pass an integer into fromArray() +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- + +--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 index 0000000000..ba81428aff --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromArray_invalid_parameter_002.phpt @@ -0,0 +1,10 @@ +--TEST-- +pass a string into fromArray() +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- + +--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 index 0000000000..034d457318 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromarray_indexes.phpt @@ -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-- + 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 index 0000000000..ecae2ab762 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromarray_non_indexes.phpt @@ -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-- + 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 index 0000000000..80d966997b --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromarray_param_boolean.phpt @@ -0,0 +1,10 @@ +--TEST-- +Tries to create a SplFixedArray using a boolean value. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- + +--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 index 0000000000..f57fe78fb8 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_fromarray_param_multiarray.phpt @@ -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-- + +--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 index 0000000000..ef4f40c32f --- /dev/null +++ b/ext/spl/tests/SplFixedArray_getSize_pass_param.phpt @@ -0,0 +1,12 @@ +--TEST-- +SplFixedArray::getSize() pass a parameter when none are expected +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..300e6df790 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_key_param.phpt @@ -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-- +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 index 0000000000..97e48115fb --- /dev/null +++ b/ext/spl/tests/SplFixedArray_key_setsize.phpt @@ -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-- +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 index 0000000000..5e8cb633b9 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_next_param.phpt @@ -0,0 +1,18 @@ +--TEST-- +SplFixedArray::next() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..76ee2f58ad --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetExists_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL FixedArray offsetExists throws error only one parameter +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..9bfda34073 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetExists_less_than_zero.phpt @@ -0,0 +1,13 @@ +--TEST-- +SPL FixedArray offsetExists behaviour on a negative index +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..71a1bf80f2 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetGet_invalid_parameter.phpt @@ -0,0 +1,16 @@ +--TEST-- +SPL FixedArray offsetGet throws error on no parameter +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..4e43a525fc --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetSet_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL FixedArray offsetSet throws error on no parameters +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..c19cd01763 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetSet_one_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL FixedArray offsetSet throws error only one parameter +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..40a372bd91 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetUnset_invalid_parameter.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL FixedArray offsetUnset throws error on no parameter +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..21976b552c --- /dev/null +++ b/ext/spl/tests/SplFixedArray_offsetUnset_string.phpt @@ -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-- +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 index 0000000000..7002efb313 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_rewind_param.phpt @@ -0,0 +1,18 @@ +--TEST-- +SplFixedArray::rewind() with a parameter. *BUG* +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..a460747608 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setSize_filled_to_smaller.phpt @@ -0,0 +1,22 @@ +--TEST-- +Create array, fills it with and resizes it to lower value. +--CREDITS-- +Philip Norton philipnorton42@gmail.com +--FILE-- +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 index 0000000000..269a45de1b --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setSize_param_array.phpt @@ -0,0 +1,18 @@ +--TEST-- +SplFixedArray::setSize() with an array parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..c65686c61d --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setSize_param_float.phpt @@ -0,0 +1,19 @@ +--TEST-- +SplFixedArray::setSize() with a float param +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..ddb37be9f0 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setSize_param_null.phpt @@ -0,0 +1,13 @@ +--TEST-- +SplFixedArray::setSize() with a null parameter +--CREDITS-- +PHPNW Testfest 2009 - Adrian Hardy +--FILE-- +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 index 0000000000..eb8e1d9dcb --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setSize_reduce.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL FixedArray can reduce size of array +--CREDITS-- +PHPNW TestFest 2009 - Ben Longden +--FILE-- +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 index 0000000000..925912ceba --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setsize_001.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: FixedArray: setsize - populate array, then shrink +--CREDITS-- +PHPNW TestFest2009 - Rowan Merewood +--FILE-- +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 index 0000000000..418d1ac37c --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setsize_grow.phpt @@ -0,0 +1,30 @@ +--TEST-- +SplFixedArray::setSize() grow +--CREDITS-- +PHPNW Test Fest 2009 - Jordan Hatch +--FILE-- +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 index 0000000000..2130cf8685 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_setsize_shrink.phpt @@ -0,0 +1,28 @@ +--TEST-- +shrink a full array of integers +--CREDITS-- +PHPNW Testfest 2009 - Lorna Mitchell +--FILE-- +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 index 0000000000..8864362c67 --- /dev/null +++ b/ext/spl/tests/SplFixedArray_toArray_with-params.phpt @@ -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-- +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 index 0000000000..9449d64d8d --- /dev/null +++ b/ext/spl/tests/SplFixedarray_offsetExists_larger.phpt @@ -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-- +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 index 0000000000..727790eabd --- /dev/null +++ b/ext/spl/tests/SplHeap_count_invalid_parameter.phpt @@ -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-- +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 index 0000000000..ba03976396 --- /dev/null +++ b/ext/spl/tests/SplHeap_extract_invalid_parameter.phpt @@ -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-- +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 index 0000000000..86c6b6370e --- /dev/null +++ b/ext/spl/tests/SplHeap_insert_invalid_parameter.phpt @@ -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-- +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 index 0000000000..e179dbc8ec --- /dev/null +++ b/ext/spl/tests/SplHeap_isEmpty.phpt @@ -0,0 +1,15 @@ +--TEST-- +Check that SplHeap::isEmpty standard success test +--CREDITS-- +PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com) +--FILE-- +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 index 0000000000..021aff423f --- /dev/null +++ b/ext/spl/tests/SplHeap_isEmpty_invalid_parameter.phpt @@ -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-- +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 index 0000000000..62605b1dcf --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt @@ -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-- +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 index 0000000000..d984429b09 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_attach_invalid_parameter.phpt @@ -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-- +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 index 0000000000..f523928702 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_contains_invalid_parameter.phpt @@ -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-- +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 index 0000000000..65fa69147a --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_current_empty_storage.phpt @@ -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-- +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 index 0000000000..83b79fcbf2 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_detach_invalid_parameter.phpt @@ -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-- +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 index 0000000000..e6c4de88c1 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_getInfo_empty_storage.phpt @@ -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-- +getInfo()); + +?> +--EXPECT-- +NULL + diff --git a/ext/spl/tests/SplObjectStorage_offsetGet.phpt b/ext/spl/tests/SplObjectStorage_offsetGet.phpt new file mode 100644 index 0000000000..e73f6b1bd6 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_offsetGet.phpt @@ -0,0 +1,17 @@ +--TEST-- +Standard success for SplObjectStorage::offsetGet +--CREDITS-- +PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com) +--FILE-- +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 index 0000000000..3f8bd437ec --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_offsetGet_invalid_parameter.phpt @@ -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-- +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 index 0000000000..72b032c4ad --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_offsetGet_missing_object.phpt @@ -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-- +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 index 0000000000..ffd339869f --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_removeAll_invalid_parameter.phpt @@ -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-- +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 index 0000000000..c8c3cd1030 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_setInfo_empty_storage.phpt @@ -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-- +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 index 0000000000..52f8f9b8e6 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_setInfo_invalid_parameter.phpt @@ -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-- +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 index 0000000000..dcf43e21f2 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter1.phpt @@ -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-- +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 index 0000000000..be2bb331b4 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter2.phpt @@ -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-- +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 index 0000000000..4c2dd75e14 --- /dev/null +++ b/ext/spl/tests/SplObjectStorage_unserialize_invalid_parameter3.phpt @@ -0,0 +1,19 @@ +--TEST-- +Check that SplObjectStorage::unserialize throws exception when NULL passed +--CREDITS-- +PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com) +--FILE-- +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 index 0000000000..7dda782b93 --- /dev/null +++ b/ext/spl/tests/SplPriorityQueue_extract_invalid_parameter.phpt @@ -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-- +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 index 0000000000..7d7b589356 --- /dev/null +++ b/ext/spl/tests/SplPriorityQueue_insert_invalid_parameter.phpt @@ -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-- +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 index 0000000000..172a1d97a4 --- /dev/null +++ b/ext/spl/tests/SplQueue_setIteratorMode.phpt @@ -0,0 +1,15 @@ +--TEST-- +Check that SplQueue can't be set to LIFO +--CREDITS-- +Rob Knight PHPNW Test Fest 2009 +--FILE-- +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 index 0000000000..c3071f2399 --- /dev/null +++ b/ext/spl/tests/SplQueue_setIteratorMode_param_lifo.phpt @@ -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-- +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 index 0000000000..d70105e034 --- /dev/null +++ b/ext/spl/tests/SplStack_setIteratorMode.phpt @@ -0,0 +1,15 @@ +--TEST-- +Check that SplStack can't be set to FIFO +--CREDITS-- +Rob Knight PHPNW Test Fest 2009 +--FILE-- +setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); +} catch (Exception $e) { + echo $e->getMessage(); +} +?> +--EXPECTF-- +Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen -- 2.40.0