Page MenuHomec4science

PhabricatorPolicyAwareTestQuery.php
No OneTemporary

File Metadata

Created
Mon, Dec 30, 21:18

PhabricatorPolicyAwareTestQuery.php

<?php
/**
* Configurable test query for implementing Policy unit tests.
*/
final class PhabricatorPolicyAwareTestQuery
extends PhabricatorPolicyAwareQuery {
private $results;
private $offset = 0;
public function setResults(array $results) {
$this->results = $results;
return $this;
}
protected function willExecute() {
$this->offset = 0;
}
protected function loadPage() {
if ($this->getRawResultLimit()) {
return array_slice(
$this->results,
$this->offset,
$this->getRawResultLimit());
} else {
return array_slice($this->results, $this->offset);
}
}
public function nextPage(array $page) {
$this->offset += count($page);
}
}

Event Timeline