Inheritance: extends curl\Collection
Esempio n. 1
0
 /**
  * Test setOptions() and getOptions() methods
  */
 public function testSetGetOptions()
 {
     $req = new cURL\Request();
     $opts = $req->getOptions();
     $this->assertInstanceOf('cURL\\Options', $opts);
     $this->assertEmpty($opts->toArray());
     $opts = new cURL\Options();
     $opts->set(CURLOPT_RETURNTRANSFER, true);
     $req->setOptions($opts);
     $this->assertEquals($opts, $req->getOptions());
 }
Esempio n. 2
0
 /**
  * Test setDefaultOptions() and getDefaultOptions()
  */
 public function testOptions()
 {
     $q = new cURL\RequestsQueue();
     $opts = $q->getDefaultOptions();
     $this->assertInstanceOf('cURL\\Options', $opts);
     $this->assertEmpty($opts->toArray());
     $opts = new cURL\Options();
     $opts->set(CURLOPT_URL, 'http://example-1/');
     $opts->set(CURLOPT_USERAGENT, 'browser');
     $q->setDefaultOptions($opts);
     $this->assertEquals($opts, $q->getDefaultOptions());
 }
Esempio n. 3
0
 public function testRemove()
 {
     $opts = new Options();
     $opts->set(CURLOPT_TIMEOUT, 123);
     $opts->set(CURLOPT_USERAGENT, 'browser');
     $this->assertTrue($opts->has(CURLOPT_TIMEOUT));
     $opts->remove(CURLOPT_TIMEOUT);
     $this->assertFalse($opts->has(CURLOPT_TIMEOUT));
     $this->assertTrue($opts->has(CURLOPT_USERAGENT));
     $opts->remove(CURLOPT_USERAGENT);
     $this->assertFalse($opts->has(CURLOPT_USERAGENT));
     $this->assertEmpty($opts->toArray());
 }