--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
--FILE--
<?php
function testForException( $heap )
{
try
{
foreach( $heap as &$item );
}
catch( RuntimeException $e )
{
echo $e->getMessage(),"\n";
}
}
$heap = new SplMinHeap;
testForException( $heap );
$heap = new SplMinHeap;
$heap->insert( 1 );
testForException( $heap );
$heap = new SplMaxHeap;
testForException( $heap );
$heap = new SplMaxHeap;
$heap->insert( 1 );
testForException( $heap );
$heap = new SplPriorityQueue;
testForException( $heap );
$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==