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:
@@ -133,6 +133,11 @@ final class PhabricatorPolicyTestCase extends PhabricatorTestCase {
|
||||
2,
|
||||
count($query->setLimit(3)->setOffset(1)->execute()),
|
||||
'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.
|
||||
*/
|
||||
|
||||
@@ -153,7 +153,11 @@ abstract class PhabricatorPolicyQuery extends PhabricatorOffsetPagedQuery {
|
||||
$limit = (int)$this->getLimit();
|
||||
$count = 0;
|
||||
|
||||
$need = $offset + $limit;
|
||||
if ($limit) {
|
||||
$need = $offset + $limit;
|
||||
} else {
|
||||
$need = 0;
|
||||
}
|
||||
|
||||
$this->willExecute();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user