xref: /dokuwiki/_test/tests/inc/httpclient_https_proxy.test.php (revision 4ad66524bcfeccd8ec19915dfb0a6ca536016320)
1<?php
2require_once dirname(__FILE__).'/httpclient_http_proxy.test.php';
3
4class httpclient_https_proxy_test extends httpclient_http_proxy_test {
5    protected $url = 'https://www.dokuwiki.org/README';
6
7    public function setUp(){
8        // skip tests when this PHP has no SSL support
9        $transports = stream_get_transports();
10        if(!in_array('ssl',$transports)){
11            $this->markTestSkipped('No SSL support available.');
12        }
13        parent::setUp();
14    }
15
16    /**
17     * @group internet
18     */
19    function test_connectfail(){
20        $http = new HTTPMockClient();
21        // proxy provided by  Andrwe Lord Weber <dokuwiki@andrwe.org>
22        $http->proxy_host = 'proxy.andrwe.org';
23        $http->proxy_port = 8080;
24
25        // the proxy accepts connections to dokuwiki.org only - the connect call should fail
26        $data = $http->get('https://www.google.com');
27        $this->assertFalse($data);
28        $this->assertEquals(-150, $http->status);
29    }
30}