[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/policy/__tests__/ -> PhabricatorPolicyAwareTestQuery.php (source)

   1  <?php
   2  
   3  /**
   4   * Configurable test query for implementing Policy unit tests.
   5   */
   6  final class PhabricatorPolicyAwareTestQuery
   7    extends PhabricatorPolicyAwareQuery {
   8  
   9    private $results;
  10    private $offset = 0;
  11  
  12    public function setResults(array $results) {
  13      $this->results = $results;
  14      return $this;
  15    }
  16  
  17    protected function willExecute() {
  18      $this->offset = 0;
  19    }
  20  
  21    protected function loadPage() {
  22      if ($this->getRawResultLimit()) {
  23        return array_slice(
  24          $this->results,
  25          $this->offset,
  26          $this->getRawResultLimit());
  27      } else {
  28        return array_slice($this->results, $this->offset);
  29      }
  30    }
  31  
  32    public function nextPage(array $page) {
  33      $this->offset += count($page);
  34    }
  35  
  36    public function getQueryApplicationClass() {
  37      return null;
  38    }
  39  
  40  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1