diff options
Diffstat (limited to 'ext/spl/tests')
-rw-r--r-- | ext/spl/tests/SplFileInfo_setFileClass_error.phpt | 2 | ||||
-rw-r--r-- | ext/spl/tests/SplFileInfo_setInfoClass_error.phpt | 2 | ||||
-rw-r--r-- | ext/spl/tests/SplFileObject_seek_error_001.phpt | 9 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_asort_basic1.phpt | 10 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_count_basic1.phpt | 14 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_exchangeArray_basic3.phpt | 12 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_ksort_basic1.phpt | 10 | ||||
-rw-r--r-- | ext/spl/tests/arrayObject_setIteratorClass_error1.phpt | 15 | ||||
-rw-r--r-- | ext/spl/tests/bug46051.phpt | 4 | ||||
-rw-r--r-- | ext/spl/tests/bug65545.phpt | 6 | ||||
-rw-r--r-- | ext/spl/tests/fileobject_005.phpt | 12 | ||||
-rw-r--r-- | ext/spl/tests/iterator_044.phpt | 37 | ||||
-rw-r--r-- | ext/spl/tests/iterator_045.phpt | 13 | ||||
-rw-r--r-- | ext/spl/tests/iterator_count.phpt | 10 | ||||
-rw-r--r-- | ext/spl/tests/iterator_to_array.phpt | 9 | ||||
-rw-r--r-- | ext/spl/tests/regexIterator_setMode_error.phpt | 4 | ||||
-rw-r--r-- | ext/spl/tests/spl_004.phpt | 24 | ||||
-rw-r--r-- | ext/spl/tests/spl_heap_is_empty_basic.phpt | 3 | ||||
-rw-r--r-- | ext/spl/tests/spl_object_id.phpt | 8 |
19 files changed, 59 insertions, 145 deletions
diff --git a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt index 7443998013..db0186f218 100644 --- a/ext/spl/tests/SplFileInfo_setFileClass_error.phpt +++ b/ext/spl/tests/SplFileInfo_setFileClass_error.phpt @@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__); try { $info->setFileClass('stdClass'); -} catch (UnexpectedValueException $e) { +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt index a280a6e147..9a2e71defe 100644 --- a/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt +++ b/ext/spl/tests/SplFileInfo_setInfoClass_error.phpt @@ -7,7 +7,7 @@ $info = new SplFileInfo(__FILE__); try { $info->setInfoClass('stdClass'); -} catch (UnexpectedValueException $e) { +} catch (TypeError $e) { echo $e->getMessage(), "\n"; } diff --git a/ext/spl/tests/SplFileObject_seek_error_001.phpt b/ext/spl/tests/SplFileObject_seek_error_001.phpt index 4de5bcdd4d..8741e3b788 100644 --- a/ext/spl/tests/SplFileObject_seek_error_001.phpt +++ b/ext/spl/tests/SplFileObject_seek_error_001.phpt @@ -2,9 +2,7 @@ SplFileObject::seek function - test parameters --FILE-- <?php -$obj = New SplFileObject(__FILE__); -$obj->seek(1,2); -$obj->seek(); +$obj = new SplFileObject(__FILE__); try { $obj->seek(-1); } catch (LogicException $e) { @@ -12,7 +10,4 @@ try { } ?> --EXPECTF-- -Warning: SplFileObject::seek() expects exactly 1 parameter, 2 given in %s - -Warning: SplFileObject::seek() expects exactly 1 parameter, 0 given in %s -Can't seek file %s to negative line %s +Can't seek file %s to negative line -1 diff --git a/ext/spl/tests/arrayObject_asort_basic1.phpt b/ext/spl/tests/arrayObject_asort_basic1.phpt index 6c6fd2949f..094d825bb6 100644 --- a/ext/spl/tests/arrayObject_asort_basic1.phpt +++ b/ext/spl/tests/arrayObject_asort_basic1.phpt @@ -15,7 +15,11 @@ $ao1 = new ArrayObject(array(4,2,3)); $ao2 = new ArrayObject(array('a'=>4,'b'=>2,'c'=>3)); var_dump($ao1->asort()); var_dump($ao1); -var_dump($ao2->asort('blah')); +try { + var_dump($ao2->asort('blah')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($ao2); var_dump($ao2->asort(SORT_NUMERIC)); var_dump($ao2); @@ -35,9 +39,7 @@ object(ArrayObject)#%d (1) { int(4) } } - -Warning: asort() expects parameter 2 to be int, string given in %sarrayObject_asort_basic1.php on line %d -bool(false) +asort() expects parameter 2 to be int, string given object(ArrayObject)#%d (1) { ["storage":"ArrayObject":private]=> array(3) { diff --git a/ext/spl/tests/arrayObject_count_basic1.phpt b/ext/spl/tests/arrayObject_count_basic1.phpt index 41e1527f93..3271090d08 100644 --- a/ext/spl/tests/arrayObject_count_basic1.phpt +++ b/ext/spl/tests/arrayObject_count_basic1.phpt @@ -25,9 +25,6 @@ var_dump(count($c), count($ao)); unset($c[0]); unset($ao[0]); var_dump($c->count(), $ao->count()); - -//Extra args are ignored. -var_dump($ao->count('blah')); ?> ==ArrayIterator== <?php @@ -53,11 +50,8 @@ var_dump(count($c), count($ao)); unset($c[0]); unset($ao[0]); var_dump($c->count(), $ao->count()); - -//Extra args are ignored. -var_dump($ao->count('blah')); ?> ---EXPECTF-- +--EXPECT-- ==ArrayObject== int(99) int(0) @@ -67,9 +61,6 @@ int(99) int(2) int(99) int(1) - -Warning: ArrayObject::count() expects exactly 0 parameters, 1 given in %s on line %d -NULL ==ArrayIterator== int(99) int(0) @@ -79,6 +70,3 @@ int(99) int(2) int(99) int(1) - -Warning: ArrayIterator::count() expects exactly 0 parameters, 1 given in %s on line %d -NULL diff --git a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt index 823256edbc..c6759a31cf 100644 --- a/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt +++ b/ext/spl/tests/arrayObject_exchangeArray_basic3.phpt @@ -29,8 +29,8 @@ $ao = new ArrayObject($original); try { $copy = $ao->exchangeArray(); $copy['addedToCopy'] = 'added To Copy'; -} catch (Exception $e) { - echo "Exception:" . $e->getMessage() . "\n"; +} catch (TypeError $e) { + echo "Exception: " . $e->getMessage() . "\n"; } $original->addedToOriginal = 'added To Original'; var_dump($ao, $original, $copy); @@ -81,8 +81,9 @@ array(2) { --> exchangeArray() with no arg: +Exception: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given -Warning: ArrayObject::exchangeArray() expects exactly 1 parameter, 0 given in %s on line 27 +Notice: Undefined variable: copy in %s on line %d object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> object(C)#3 (2) { @@ -98,10 +99,7 @@ object(C)#3 (2) { ["addedToOriginal"]=> string(17) "added To Original" } -array(1) { - ["addedToCopy"]=> - string(13) "added To Copy" -} +NULL --> exchangeArray() with bad arg type: diff --git a/ext/spl/tests/arrayObject_ksort_basic1.phpt b/ext/spl/tests/arrayObject_ksort_basic1.phpt index 1692a02ef1..aa1abbf239 100644 --- a/ext/spl/tests/arrayObject_ksort_basic1.phpt +++ b/ext/spl/tests/arrayObject_ksort_basic1.phpt @@ -14,7 +14,11 @@ $ao1 = new ArrayObject(array(4,2,3)); $ao2 = new ArrayObject(array('b'=>4,'a'=>2,'q'=>3, 99=>'x')); var_dump($ao1->ksort()); var_dump($ao1); -var_dump($ao2->ksort('blah')); +try { + var_dump($ao2->ksort('blah')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump($ao2); var_dump($ao2->ksort(SORT_STRING)); var_dump($ao2); @@ -34,9 +38,7 @@ object(ArrayObject)#%d (1) { int(3) } } - -Warning: ksort() expects parameter 2 to be int, string given in %sarrayObject_ksort_basic1.php on line %d -bool(false) +ksort() expects parameter 2 to be int, string given object(ArrayObject)#2 (1) { ["storage":"ArrayObject":private]=> array(4) { diff --git a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt index 89efdb6a9f..d0910b3a0a 100644 --- a/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt +++ b/ext/spl/tests/arrayObject_setIteratorClass_error1.phpt @@ -8,7 +8,7 @@ try { foreach($ao as $key=>$value) { echo " $key=>$value\n"; } -} catch (Exception $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -18,7 +18,7 @@ try { foreach($ao as $key=>$value) { echo " $key=>$value\n"; } -} catch (Exception $e) { +} catch (TypeError $e) { var_dump($e->getMessage()); } @@ -43,14 +43,7 @@ try { ?> --EXPECTF-- -Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given in %s on line 4 - a=>1 - b=>2 - c=>3 - -Warning: ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given in %s on line 14 - a=>1 - b=>2 - c=>3 +string(118) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'nonExistentClass' given" +string(110) "ArrayObject::setIteratorClass() expects parameter 1 to be a class name derived from Iterator, 'stdClass' given" string(113) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'nonExistentClass' given" string(105) "ArrayObject::__construct() expects parameter 3 to be a class name derived from Iterator, 'stdClass' given" diff --git a/ext/spl/tests/bug46051.phpt b/ext/spl/tests/bug46051.phpt index e993951ffa..d53f87bc47 100644 --- a/ext/spl/tests/bug46051.phpt +++ b/ext/spl/tests/bug46051.phpt @@ -6,8 +6,8 @@ Bug #46051 (SplFileInfo::openFile - memory overlap) $x = new splfileinfo(__FILE__); try { -$x->openFile(NULL, NULL, NULL); -} catch (Exception $e) { } + $x->openFile(NULL, NULL, NULL); +} catch (TypeError $e) { } var_dump($x->getPathName()); --EXPECTF-- diff --git a/ext/spl/tests/bug65545.phpt b/ext/spl/tests/bug65545.phpt index 76c29cbf48..bd5a7f06db 100644 --- a/ext/spl/tests/bug65545.phpt +++ b/ext/spl/tests/bug65545.phpt @@ -6,9 +6,6 @@ $obj = new SplFileObject(__FILE__, 'r'); $data = $obj->fread(5); var_dump($data); -$data = $obj->fread(); -var_dump($data); - $data = $obj->fread(0); var_dump($data); @@ -20,9 +17,6 @@ var_dump(strlen($data) === filesize(__FILE__) - 5); --EXPECTF-- string(5) "<?php" -Warning: SplFileObject::fread() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: SplFileObject::fread(): Length parameter must be greater than 0 in %s on line %d bool(false) bool(true) diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt index 7b012e7710..672c806538 100644 --- a/ext/spl/tests/fileobject_005.phpt +++ b/ext/spl/tests/fileobject_005.phpt @@ -16,14 +16,11 @@ $fo->fwrite("blahlubba"); var_dump($fo->ftruncate(4)); $fo->rewind(); -var_dump($fo->fgets(8)); +var_dump($fo->fgets()); $fo->rewind(); $fo->fwrite("blahlubba"); -// This should throw a warning and return NULL since an argument is missing -var_dump($fo->ftruncate()); - ?> ==DONE== --CLEAN-- @@ -33,10 +30,5 @@ unlink($path); ?> --EXPECTF-- bool(true) - -Warning: SplFileObject::fgets() expects exactly 0 parameters, 1 given in %s on line %d -NULL - -Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d -NULL +string(4) "blah" ==DONE== diff --git a/ext/spl/tests/iterator_044.phpt b/ext/spl/tests/iterator_044.phpt index 1271ccaa64..66d03dc359 100644 --- a/ext/spl/tests/iterator_044.phpt +++ b/ext/spl/tests/iterator_044.phpt @@ -24,8 +24,16 @@ class MyCachingIterator extends CachingIterator { echo "===$k===\n"; var_dump($v); - var_dump($this->offsetExists($v)); - var_dump($this->offsetGet($v)); + try { + var_dump($this->offsetExists($v)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump($this->offsetGet($v)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } } } @@ -52,9 +60,6 @@ catch(Exception $e) $it = new MyCachingIterator(new ArrayIterator(array(0, 'foo'=>1, 2, 'bar'=>3, 4)), CachingIterator::FULL_CACHE); -var_dump($it->offsetExists()); -var_dump($it->offsetGet()); - $checks = array(0, new stdClass, new MyFoo, NULL, 2, 'foo', 3); $it->test($checks); @@ -71,12 +76,6 @@ $it->test($checks); --EXPECTF-- Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetExists() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects exactly 1 parameter, 0 given in %siterator_044.php on line %d -NULL ===0=== int(0) bool(false) @@ -86,12 +85,8 @@ NULL ===1=== object(stdClass)#%d (0) { } - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL +CachingIterator::offsetExists() expects parameter 1 to be string, object given +CachingIterator::offsetGet() expects parameter 1 to be string, object given ===2=== object(MyFoo)#%d (0) { } @@ -131,12 +126,8 @@ int(0) ===1=== object(stdClass)#1 (0) { } - -Warning: CachingIterator::offsetExists() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL - -Warning: CachingIterator::offsetGet() expects parameter 1 to be string, object given in %siterator_044.php on line %d -NULL +CachingIterator::offsetExists() expects parameter 1 to be string, object given +CachingIterator::offsetGet() expects parameter 1 to be string, object given ===2=== object(MyFoo)#2 (0) { } diff --git a/ext/spl/tests/iterator_045.phpt b/ext/spl/tests/iterator_045.phpt index c8ffae77a5..fce7ab3655 100644 --- a/ext/spl/tests/iterator_045.phpt +++ b/ext/spl/tests/iterator_045.phpt @@ -73,10 +73,6 @@ catch(Exception $e) $it = new MyCachingIterator(new ArrayIterator(array(0, 1, 2, 3)), CachingIterator::FULL_CACHE); -var_dump($it->offsetSet()); -var_dump($it->offsetSet(0)); -var_dump($it->offsetUnset()); - $checks = array(0 => 25, 1 => 42, 3 => 'FooBar'); $unsets = array(0, 2); @@ -97,15 +93,6 @@ $it->show(); --EXPECTF-- Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) Exception: MyCachingIterator does not use a full cache (see CachingIterator::__construct) - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 0 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetSet() expects exactly 2 parameters, 1 given in %siterator_045.php on line %d -NULL - -Warning: CachingIterator::offsetUnset() expects exactly 1 parameter, 0 given in %siterator_045.php on line %d -NULL MyCachingIterator::testSet() set(0,25) set(1,42) diff --git a/ext/spl/tests/iterator_count.phpt b/ext/spl/tests/iterator_count.phpt index c0dad0f422..944b40dd96 100644 --- a/ext/spl/tests/iterator_count.phpt +++ b/ext/spl/tests/iterator_count.phpt @@ -9,20 +9,10 @@ $array=array('a','b'); $iterator = new ArrayIterator($array); -iterator_count(); - - -iterator_count($iterator,'1'); - iterator_count('1'); - ?> --EXPECTF-- -Warning: iterator_count() expects exactly 1 parameter, 0 given in %s - -Warning: iterator_count() expects exactly 1 parameter, 2 given in %s - Fatal error: Uncaught TypeError: Argument 1 passed to iterator_count() must implement interface Traversable, string given in %s:%d Stack trace: #0 %s(%d): iterator_count('1') diff --git a/ext/spl/tests/iterator_to_array.phpt b/ext/spl/tests/iterator_to_array.phpt index f36b99db23..a5a8e5a9b7 100644 --- a/ext/spl/tests/iterator_to_array.phpt +++ b/ext/spl/tests/iterator_to_array.phpt @@ -9,19 +9,10 @@ $array=array('a','b'); $iterator = new ArrayIterator($array); -iterator_to_array(); - - -iterator_to_array($iterator,'test','test'); - iterator_to_array('test','test'); ?> --EXPECTF-- -Warning: iterator_to_array() expects at least 1 parameter, 0 given in %s - -Warning: iterator_to_array() expects at most 2 parameters, 3 given in %s - Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, string given in %s:%d Stack trace: #0 %s(%d): iterator_to_array('test', 'test') diff --git a/ext/spl/tests/regexIterator_setMode_error.phpt b/ext/spl/tests/regexIterator_setMode_error.phpt index 77732b058c..046086102b 100644 --- a/ext/spl/tests/regexIterator_setMode_error.phpt +++ b/ext/spl/tests/regexIterator_setMode_error.phpt @@ -17,12 +17,8 @@ try { var_dump($e->getCode()); } -$regexIterator->setMode('foo'); - ?> --EXPECTF-- int(0) string(14) "Illegal mode 7" int(0) - -Warning: RegexIterator::setMode() expects parameter 1 to be int, string given in %s on line %d diff --git a/ext/spl/tests/spl_004.phpt b/ext/spl/tests/spl_004.phpt index 60de68b82a..72458446e1 100644 --- a/ext/spl/tests/spl_004.phpt +++ b/ext/spl/tests/spl_004.phpt @@ -44,11 +44,19 @@ var_dump(iterator_apply($it, 'test')); echo "===ERRORS===\n"; try { var_dump(iterator_apply($it, 'test', 1)); -} catch (Error $e) { - my_error_handler($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(iterator_apply($it, 'non_existing_function')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(iterator_apply($it, 'non_existing_function', NULL, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; } -var_dump(iterator_apply($it, 'non_existing_function')); -var_dump(iterator_apply($it, 'non_existing_function', NULL, 2)); ?> ===DONE=== @@ -78,9 +86,7 @@ int(5) int(6) int(4) ===ERRORS=== -Error: Argument 3 passed to iterator_apply() must be of the type array or null, int given -Error: iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name -NULL -Error: iterator_apply() expects at most 3 parameters, 4 given -NULL +Argument 3 passed to iterator_apply() must be of the type array or null, int given +iterator_apply() expects parameter 2 to be a valid callback, function 'non_existing_function' not found or invalid function name +iterator_apply() expects at most 3 parameters, 4 given ===DONE=== diff --git a/ext/spl/tests/spl_heap_is_empty_basic.phpt b/ext/spl/tests/spl_heap_is_empty_basic.phpt index 47d7ccce9a..4a90734ad4 100644 --- a/ext/spl/tests/spl_heap_is_empty_basic.phpt +++ b/ext/spl/tests/spl_heap_is_empty_basic.phpt @@ -21,11 +21,8 @@ $heap->insert(1); var_dump($heap->isEmpty()); $heap->extract(); var_dump($heap->isEmpty()); -$heap->isEmpty('var'); ?> --EXPECTF-- bool(true) bool(false) bool(true) - -Warning: SplHeap::isEmpty() expects exactly 0 parameters, 1 given in %s diff --git a/ext/spl/tests/spl_object_id.phpt b/ext/spl/tests/spl_object_id.phpt index ca13b03fee..a4e8518eaf 100644 --- a/ext/spl/tests/spl_object_id.phpt +++ b/ext/spl/tests/spl_object_id.phpt @@ -4,18 +4,10 @@ SPL: spl_object_id() <?php var_dump(spl_object_id(new stdClass)); -var_dump(spl_object_id(42)); -var_dump(spl_object_id()); $a = new stdClass(); var_dump(spl_object_id(new stdClass) === spl_object_id($a)); ?> --EXPECTF-- int(%d) - -Warning: spl_object_id() expects parameter 1 to be object, int given in %sspl_object_id.php on line %d -NULL - -Warning: spl_object_id() expects exactly 1 parameter, 0 given in %sspl_object_id.php on line %d -NULL bool(false) |