public function testNoLog()
 {
     $logger = $this->getMock('Psr\\Log\\LoggerInterface');
     $logger->expects($this->never())->method('info');
     $filter = new RequestFilter($logger, 1);
     $req = new \SS_HTTPRequest('GET', '/');
     $mod = new \DataModel();
     $filter->preRequest($req, new \Session(array()), $mod);
     sleep(0.5);
     $filter->postRequest($req, new \SS_HTTPResponse(), $mod);
 }
 /**
  * Register the requested policies with the global request filter. This doesn't mean the policies will be
  * executed at this point - it will rather be delayed until the RequestProcessor::postRequest runs.
  */
 public function onAfterInit()
 {
     if (!$this->getPolicies()) {
         return;
     }
     // Flip the policy array, so the first element in the array is the one applying last.
     // This is needed so the policies on inheriting Controllers are in the intuitive order:
     // the more specific overrides the less specific.
     $policies = array_reverse($this->getPolicies());
     foreach ($policies as $policy) {
         $this->requestFilter->requestPolicy($this->owner, $policy);
     }
 }
Пример #3
0
 /**
  * Gets an array representation
  *
  * @return array
  */
 public function toArray()
 {
     return array('AllFields' => $this->allFields, 'Interest' => $this->interest, 'LastModifiedOnly' => $this->lastModifiedOnly, 'Offset' => $this->offset, 'RequestFilter' => $this->requestFilter->toArray(), 'ReturnFields' => $this->returnFields);
 }