Annotation of embedaddon/php/ext/spl/tests/heap_009.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: SPL: SplHeap and friends, throw: An iterator cannot be used with foreach by reference
        !             3: --CREDITS--
        !             4: Thomas Koch <thomas@koch.ro>
        !             5: #Hackday Webtuesday 2008-05-24
        !             6: --FILE--
        !             7: <?php
        !             8: function testForException( $heap )
        !             9: {
        !            10:     try
        !            11:     {
        !            12:         foreach( $heap as &$item );
        !            13:     }
        !            14:     catch( RuntimeException $e )
        !            15:     {
        !            16:         echo $e->getMessage(),"\n";
        !            17:     }
        !            18: }
        !            19: 
        !            20: // 1. SplMinHeap emtpy
        !            21: $heap = new SplMinHeap;
        !            22: testForException( $heap );
        !            23: 
        !            24: // 2. SplMinHeap non-emtpy
        !            25: $heap = new SplMinHeap;
        !            26: $heap->insert( 1 );
        !            27: testForException( $heap );
        !            28: 
        !            29: // 3. SplMaxHeap emtpy
        !            30: $heap = new SplMaxHeap;
        !            31: testForException( $heap );
        !            32: 
        !            33: // 4. SplMaxHeap non-emtpy
        !            34: $heap = new SplMaxHeap;
        !            35: $heap->insert( 1 );
        !            36: testForException( $heap );
        !            37: 
        !            38: // 5. SplPriorityQueue empty
        !            39: $heap = new SplPriorityQueue;
        !            40: testForException( $heap );
        !            41: 
        !            42: // 6. SplPriorityQueue non-empty
        !            43: $heap = new SplPriorityQueue;
        !            44: $heap->insert( 1, 2 );
        !            45: testForException( $heap );
        !            46: 
        !            47: ?>
        !            48: ==DONE==
        !            49: --EXPECT--
        !            50: An iterator cannot be used with foreach by reference
        !            51: An iterator cannot be used with foreach by reference
        !            52: An iterator cannot be used with foreach by reference
        !            53: An iterator cannot be used with foreach by reference
        !            54: An iterator cannot be used with foreach by reference
        !            55: An iterator cannot be used with foreach by reference
        !            56: ==DONE==

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>