/** * Add a request to the multi handle * * @param \Bronto\Transfer\Curl\Request $request * @return self */ public function add(Request $request) { $handle = $request->prepare()->getHandle(); $this->_requests[(int) $handle->getResource()] = $request; $this->_multi->addHandle($handle->getResource()); if ($this->_executeEagerly) { $running = 0; $this->_multi->byRef('exec', $running); } // Reap enough to clear out the threshold if (count($this->_requests) > $this->_threshold) { $this->complete($this->_threshold); } return $this; }
/** * @test * @gorup pmc */ public function testPurge() { $curl = $this->_mockCurl(); $curl->expects($this->once())->method('init')->with('http://google.com'); $curl->expects($this->exactly(4))->method('setopt')->withConsecutive(array($this->equalTo(CURLOPT_RETURNTRANSFER), $this->equalTo(true)), array($this->equalTo(CURLOPT_HEADER), $this->equalTo(true)), array($this->equalTo(CURLOPT_CUSTOMREQUEST), $this->equalTo('PURGE')), array($this->equalTo(CURLOPT_HTTPHEADER), $this->equalTo(array("X-HTTP-Method-Override: PURGE")))); $request = new Request('PURGE', 'http://google.com', new \Bronto\DataObject(), $curl); $request->prepare(); }
public function initLogin() { $databaseData = ['username' => 'login', 'password' => 'w dupe trzasword']; $requ = Request::prepare('Login::Step1', $databaseData); $requ->send(array($this, 'secondLoginStep')); }