Beispiel #1
0
 public function testUsesProxyEnvironmentVariables()
 {
     $http = isset($_SERVER['HTTP_PROXY']) ? $_SERVER['HTTP_PROXY'] : null;
     $https = isset($_SERVER['HTTPS_PROXY']) ? $_SERVER['HTTPS_PROXY'] : null;
     unset($_SERVER['HTTP_PROXY']);
     unset($_SERVER['HTTPS_PROXY']);
     $client = new puzzle_Client();
     $this->assertNull($client->getDefaultOption('proxy'));
     $_SERVER['HTTP_PROXY'] = '127.0.0.1';
     $client = new puzzle_Client();
     $this->assertEquals(array('http' => '127.0.0.1'), $client->getDefaultOption('proxy'));
     $_SERVER['HTTPS_PROXY'] = '127.0.0.2';
     $client = new puzzle_Client();
     $this->assertEquals(array('http' => '127.0.0.1', 'https' => '127.0.0.2'), $client->getDefaultOption('proxy'));
     $_SERVER['HTTP_PROXY'] = $http;
     $_SERVER['HTTPS_PROXY'] = $https;
 }