protected function setUp() { # Valid values $this->Request = new Request(); $this->Response = new Response(); $this->Client = $this->getMockForAbstractClass('\\BLW\\Type\\HTTP\\AClient'); $this->Client->setMediator(new Mediator()); $this->Request->setURI(new GenericURI('http://example.com')); $this->Client->attach($this->Request, $this->Response); }
/** * Validates an instance of IRequest. * * @param \BLW\Type\HTTP\IRequest $Request * Object to test. * @return boolean <code>TRUE</code> if valid. <code>FALSE</code> otherwise. */ public static function validateRequest($Request) { // Validate $Request switch (true) { // $Request not a request case !$Request instanceof IRequest: // $Request has no target URI // $Request has no target URI case !$Request->getURI() instanceof IURI: // No Timeout // No Timeout case !isset($Request->Config['Timeout']): // No MaxRedirects // No MaxRedirects case !isset($Request->Config['MaxRedirects']): // No EnableCookies // No EnableCookies case !isset($Request->Config['EnableCookies']): return false; // All is well // All is well default: return true; } }
/** * Reschedules a request for processing. * * @ignore * @param \BLW\Type\HTTP\IRequest $Request */ private function _reschedule(IRequest $Request) { $Response = new Response('HTTP', '1.0', 0); $Response['Running'] = false; $Response['Finished'] = false; $Response->setRequestURI($Request->getURI()); $this[$Request] = $Response; }