/** * @covers Robo47_Curl::getOptions * @covers Robo47_Curl::setOptions * @covers Robo47_Curl::setOption */ public function testSetGetOptions() { $curl = new Robo47_Curl('http://example.com', true); $curl->setOption(CURLOPT_AUTOREFERER, true); $options = $curl->getOptions(); $this->assertArrayHasKey(CURLOPT_URL, $options); $this->assertArrayHasKey(CURLOPT_AUTOREFERER, $options); $this->assertArrayHasKey(CURLOPT_RETURNTRANSFER, $options); $this->assertEquals('http://example.com', $options[CURLOPT_URL]); $this->assertTrue($options[CURLOPT_AUTOREFERER]); $this->assertTrue($options[CURLOPT_RETURNTRANSFER]); $curl = new Robo47_Curl('http://example.com', true); $newOptions = array(); $newOptions[CURLOPT_URL] = 'http://example.com'; $newOptions[CURLOPT_AUTOREFERER] = false; $newOptions[CURLOPT_RETURNTRANSFER] = false; $curl->setOptions($newOptions); unset($options); $options = $curl->getOptions(); $this->assertArrayHasKey(CURLOPT_URL, $options); $this->assertArrayHasKey(CURLOPT_AUTOREFERER, $options); $this->assertArrayHasKey(CURLOPT_RETURNTRANSFER, $options); $this->assertEquals('http://example.com', $options[CURLOPT_URL]); $this->assertFalse($options[CURLOPT_AUTOREFERER]); $this->assertFalse($options[CURLOPT_RETURNTRANSFER]); }