1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 15:21:03 +01:00

Fix offset-without-limit case in Policy query

Summary: Apparently I am not qualified to do basic math.

Test Plan: Unit test.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3218
This commit is contained in:
epriestley 2012-08-09 11:40:55 -07:00
parent bb61f03f1d
commit d4cbb00d3b
2 changed files with 10 additions and 2 deletions

View file

@ -133,6 +133,11 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
2, 2,
count($query->setLimit(3)->setOffset(1)->execute()), count($query->setLimit(3)->setOffset(1)->execute()),
'Offsets work correctly.'); 'Offsets work correctly.');
$this->assertEqual(
2,
count($query->setLimit(0)->setOffset(1)->execute()),
'Offset with no limit works.');
} }
@ -165,7 +170,6 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
} }
/** /**
* Test an object for visibility across multiple user specifications. * Test an object for visibility across multiple user specifications.
*/ */

View file

@ -153,7 +153,11 @@ abstract class PhabricatorPolicyQuery extends PhabricatorOffsetPagedQuery {
$limit = (int)$this->getLimit(); $limit = (int)$this->getLimit();
$count = 0; $count = 0;
$need = $offset + $limit; if ($limit) {
$need = $offset + $limit;
} else {
$need = 0;
}
$this->willExecute(); $this->willExecute();