summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe.Boulain <>2010-04-12 07:09:28 +0000
committerChristophe.Boulain <>2010-04-12 07:09:28 +0000
commitea61b2565c76a9c663e59fed36702cb2c4ecf541 (patch)
tree76e3efb989d4aeeb84442ffe604843dc1660e099
parent4eaf5403f98a7c9cb01bfb53e020326db0ca9fc2 (diff)
Fixed Issue#246
-rw-r--r--HISTORY1
-rw-r--r--framework/Collections/TQueue.php5
-rw-r--r--tests/unit/Collections/TQueueTest.php2
3 files changed, 4 insertions, 4 deletions
diff --git a/HISTORY b/HISTORY
index 95cd545d..f82f407a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -14,6 +14,7 @@ ENH: Issue#173 - Add "dragdropextra" (superghosting) patch, mouse coordinates an
NEW: Add TActiveMultiView (LCS Team)
NEW: Beta of master/slave senario solution (Yves)
ENH: Update TDraggable::revert property to accept "failure" value (Christophe)
+BUG: Issue#246: TQueue::peek returns the top not the bottom (Christophe)
Version 3.1.7 February 22, 2010
ENH: Issue#24 - Specify needed fields on demand (Yves)
diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php
index 1eacfb0a..5e10ecdf 100644
--- a/framework/Collections/TQueue.php
+++ b/framework/Collections/TQueue.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Collections
@@ -106,7 +106,6 @@ class TQueue extends TComponent implements IteratorAggregate,Countable
/**
* Returns the item at the top of the queue.
- * Unlike {@link pop()}, this method does not remove the item from the queue.
* @return mixed item at the top of the queue
* @throws TInvalidOperationException if the queue is empty
*/
@@ -115,7 +114,7 @@ class TQueue extends TComponent implements IteratorAggregate,Countable
if($this->_c===0)
throw new TInvalidOperationException('queue_empty');
else
- return $this->_d[$this->_c-1];
+ return $this->_d[0];
}
/**
diff --git a/tests/unit/Collections/TQueueTest.php b/tests/unit/Collections/TQueueTest.php
index 1c755480..d04f647e 100644
--- a/tests/unit/Collections/TQueueTest.php
+++ b/tests/unit/Collections/TQueueTest.php
@@ -57,7 +57,7 @@ class TQueueTest extends PHPUnit_Framework_TestCase {
}
public function testPeek() {
- $queue = new TQueue(array(1));
+ $queue = new TQueue(array(1,2,3));
self::assertEquals(1, $queue->peek());
}