public function peek() { if ($this->_c === 0) { throw new TInvalidOperationException('queue_empty'); } else { return $this->_d[0]; } }
public function testCanNotPeekAnEmptyQueue() { $queue = new TQueue(); try { $item = $queue->peek(); } catch (TInvalidOperationException $e) { return; } self::fail('An expected TInvalidOperationException was not raised'); }