summaryrefslogtreecommitdiff
path: root/_test/tests/inc/httpclient_https_proxy.test.php
blob: cf5b9a8b933f4f5db18a1759c62122d3c8c2c184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
require_once dirname(__FILE__).'/httpclient_http_proxy.test.php';

class httpclient_https_proxy_test extends httpclient_http_proxy_test {
    protected $url = 'https://httpbin.org/user-agent';

    public function setUp(){
        // skip tests when this PHP has no SSL support
        $transports = stream_get_transports();
        if(!in_array('ssl',$transports)){
            $this->markTestSkipped('No SSL support available.');
        }
        parent::setUp();
    }

    /**
     * @group internet
     */
    function test_connectfail(){
        $http = new HTTPMockClient();
        // proxy provided by  Andrwe Lord Weber <dokuwiki@andrwe.org>
        $http->proxy_host = 'proxy.andrwe.org';
        $http->proxy_port = 8080;

        // the proxy accepts connections to dokuwiki.org only - the connect call should fail
        $data = $http->get('https://www.google.com');
        $this->assertFalse($data);
        $this->assertEquals(-150, $http->status);
    }
}