Ejemplo n.º 1
0
 public function testCanCloseAll()
 {
     $m = curl_multi_init();
     $b = new BatchContext($m, true);
     $h = curl_init();
     $t = new Transaction(new Client(), new Request('GET', 'http://httbin.org'));
     $b->addTransaction($t, $h);
     $b->removeAll();
     $this->assertFalse($b->isActive());
     $this->assertEquals(0, count($this->readAttribute($b, 'handles')));
     curl_multi_close($m);
 }
Ejemplo n.º 2
0
 private function throwException(\Exception $e, BatchContext $context)
 {
     if ($context->throwsExceptions() || $e instanceof RequestException && $e->getThrowImmediately()) {
         $context->removeAll();
         $this->releaseMultiHandle($context->getMultiHandle());
         throw $e;
     }
 }