cvs: php-src(PHP_5_3) /ext/spl/tests fileobject_005.phpt heap_009.phpt

From: Date: Sat, 24 May 2008 16:49:04 +0000
Subject: cvs: php-src(PHP_5_3) /ext/spl/tests fileobject_005.phpt heap_009.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-50127@lists.php.net to get a copy of this message
colder Sat May 24 16:49:04 2008 UTC Added files: (Branch: PHP_5_3) /php-src/ext/spl/tests heap_009.phpt fileobject_005.phpt Log: New tests from testfest http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/heap_009.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/heap_009.phpt +++ php-src/ext/spl/tests/heap_009.phpt --TEST-- SPL: SplHeap and friends, throw: An iterator cannot be used with foreach by reference --CREDITS-- Thomas Koch <thomas@koch.ro> #Hackday Webtuesday 2008-05-24 --SKIPIF-- <?php if (!extension_loaded("spl")) print "skip"; ?> --FILE-- <?php function testForException( $heap ) { try { foreach( $heap as &$item ); } catch( RuntimeException $e ) { echo $e->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== http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/fileobject_005.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/fileobject_005.phpt +++ php-src/ext/spl/tests/fileobject_005.phpt --TEST-- SPL: SplFileObject truncate tests --SKIPIF-- <?php if (!extension_loaded("spl")) print "skip"; ?> --CREDITS-- Mark Ammann #Hackday Webtuesday 2008-05-24 --FILE-- <?php set_include_path(dirname(dirname(__FILE__))); $path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt'; touch($path); $fo = new SplFileObject('tests'.DIRECTORY_SEPARATOR.'fileobject_005.txt', 'w+', true); $fo->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-- <?php $path = dirname(__FILE__).DIRECTORY_SEPARATOR.'fileobject_005.txt'; unlink($path); ?> --EXPECTF-- bool(true) string(4) "blah" Warning: SplFileObject::ftruncate() expects exactly 1 parameter, 0 given in %s on line %d NULL ==DONE==

« previous php.cvs (#50127) next »