public function testOrder()
 {
     $item1 = 'item 1';
     $item2 = 'item 2';
     $item3 = 'item 3';
     $items = [$item1, $item2, $item3];
     $stack = new Stack($items);
     $this->assertSame($item3, $stack->peek());
     $pops = [];
     $iters = [];
     foreach ($stack as $element) {
         $iters[] = $element;
     }
     while (($item = $stack->pop()) !== null) {
         $pops[] = $item;
     }
     $this->assertSame($iters, $pops);
     $stack->clear();
     $this->assertNull($stack->peek());
 }
Beispiel #2
0
 public function postRun(KernelHandleEvent $e)
 {
     $this->domainStack->pop();
     $this->domain = $this->domainStack->peek();
 }