Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Paginator: Group by must be reseted #3791

Merged
merged 2 commits into from Feb 15, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions library/Zend/Paginator/Adapter/DbSelect.php
Expand Up @@ -107,6 +107,7 @@ public function count()
$select->reset(Select::LIMIT);
$select->reset(Select::OFFSET);
$select->reset(Select::ORDER);
$select->reset(Select::GROUP);

$select->columns(array('c' => new Expression('COUNT(1)')));

Expand Down
2 changes: 1 addition & 1 deletion tests/ZendTest/Paginator/Adapter/DbSelectTest.php
Expand Up @@ -62,7 +62,7 @@ public function testCount()
{
$this->mockSelect->expects($this->once())->method('columns')->with($this->equalTo(array('c' => new Expression('COUNT(1)'))));
$this->mockResult->expects($this->any())->method('current')->will($this->returnValue(array('c' => 5)));
$this->mockSelect->expects($this->exactly(4))->method('reset'); // called for columns, limit, offset, order
$this->mockSelect->expects($this->exactly(5))->method('reset'); // called for columns, limit, offset, order
$count = $this->dbSelect->count();
$this->assertEquals(5, $count);
}
Expand Down