From: Etienne Kneuss Date: Sat, 24 May 2008 16:49:04 +0000 (+0000) Subject: New tests from testfest X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~150 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3623b134e1575a4879c29934f9a41b539ba29881;p=php New tests from testfest --- diff --git a/ext/spl/tests/fileobject_005.phpt b/ext/spl/tests/fileobject_005.phpt new file mode 100644 index 0000000000..c65da830b9 --- /dev/null +++ b/ext/spl/tests/fileobject_005.phpt @@ -0,0 +1,42 @@ +--TEST-- +SPL: SplFileObject truncate tests +--SKIPIF-- + +--CREDITS-- +Mark Ammann +#Hackday Webtuesday 2008-05-24 +--FILE-- +fwrite("blahlubba"); +var_dump($fo->ftruncate(4)); + +$fo->rewind(); +var_dump($fo->fgets(8)); + +$fo->rewind(); +$fo->fwrite("blahlubba"); + +// This should throw a warning and return NULL since an argument is missing +var_dump($fo->ftruncate()); + +?> +==DONE== +--CLEAN-- + +--EXPECTF-- +bool(true) +string(4) "blah" + +Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d +NULL +==DONE== diff --git a/ext/spl/tests/heap_009.phpt b/ext/spl/tests/heap_009.phpt new file mode 100644 index 0000000000..b6dad3d5a2 --- /dev/null +++ b/ext/spl/tests/heap_009.phpt @@ -0,0 +1,58 @@ +--TEST-- +SPL: SplHeap and friends, throw: An iterator cannot be used with foreach by reference +--CREDITS-- +Thomas Koch +#Hackday Webtuesday 2008-05-24 +--SKIPIF-- + +--FILE-- +getMessage(),"\n"; + } +} + +// 1. SplMinHeap emtpy +$heap = new SplMinHeap; +testForException( $heap ); + +// 2. SplMinHeap non-emtpy +$heap = new SplMinHeap; +$heap->insert( 1 ); +testForException( $heap ); + +// 3. SplMaxHeap emtpy +$heap = new SplMaxHeap; +testForException( $heap ); + +// 4. SplMaxHeap non-emtpy +$heap = new SplMaxHeap; +$heap->insert( 1 ); +testForException( $heap ); + +// 5. SplPriorityQueue empty +$heap = new SplPriorityQueue; +testForException( $heap ); + +// 6. SplPriorityQueue non-empty +$heap = new SplPriorityQueue; +$heap->insert( 1, 2 ); +testForException( $heap ); + +?> +==DONE== +--EXPECT-- +An iterator cannot be used with foreach by reference +An iterator cannot be used with foreach by reference +An iterator cannot be used with foreach by reference +An iterator cannot be used with foreach by reference +An iterator cannot be used with foreach by reference +An iterator cannot be used with foreach by reference +==DONE==