public function testProxy() { $serverBackup = $_SERVER; $tmpfile = tempnam(sys_get_temp_dir(), 'composer_unit_test_'); $_SERVER['no_proxy'] = 'example.com'; $_SERVER['HTTP_PROXY'] = 'http://example.com:8080'; $req = new CopyRequest('http://localhost', $tmpfile, false, $this->iop->reveal(), $this->configp->reveal()); $this->assertArrayHasKey(CURLOPT_PROXY, $req->getCurlOptions()); $req = new CopyRequest('http://example.com', $tmpfile, false, $this->iop->reveal(), $this->configp->reveal()); $this->assertArrayNotHasKey(CURLOPT_PROXY, $req->getCurlOptions()); $_SERVER = $serverBackup; }