GuzzleHttp\Tests\ClientTest::testUsesProxyEnvironmentVariables PHP Method

testUsesProxyEnvironmentVariables() public method

    public function testUsesProxyEnvironmentVariables()
    {
        $http = getenv('HTTP_PROXY');
        $https = getenv('HTTPS_PROXY');
        $no = getenv('NO_PROXY');
        $client = new Client();
        $this->assertNull($client->getConfig('proxy'));
        putenv('HTTP_PROXY=127.0.0.1');
        $client = new Client();
        $this->assertEquals(['http' => '127.0.0.1'], $client->getConfig('proxy'));
        putenv('HTTPS_PROXY=127.0.0.2');
        putenv('NO_PROXY=127.0.0.3, 127.0.0.4');
        $client = new Client();
        $this->assertEquals(['http' => '127.0.0.1', 'https' => '127.0.0.2', 'no' => ['127.0.0.3', '127.0.0.4']], $client->getConfig('proxy'));
        putenv("HTTP_PROXY={$http}");
        putenv("HTTPS_PROXY={$https}");
        putenv("NO_PROXY={$no}");
    }