[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> httpclient_http_proxy.test.php (source)

   1  <?php
   2  
   3  require_once (__DIR__ . '/httpclient_mock.php');
   4  
   5  class httpclient_http_proxy_test extends DokuWikiTest
   6  {
   7      protected $url = 'http://httpbingo.org/user-agent';
   8      protected $host;
   9      protected $port;
  10  
  11  
  12      public function setUp(): void
  13      {
  14          parent::setUp();
  15          $configuration = DOKU_UNITTEST . "proxy.conf.php";
  16          if (file_exists($configuration)) {
  17              /** @var $conf array */
  18              include $configuration;
  19              $this->host = $conf['host'];
  20              $this->port = $conf['port'];
  21          }
  22  
  23          if (!$this->host || !$this->port) {
  24              $this->markTestSkipped("Skipped proxy tests. Missing configuration");
  25          }
  26      }
  27  
  28  
  29      /**
  30       * @group internet
  31       */
  32      function testSimpleGet()
  33      {
  34          $http = new HTTPMockClient();
  35          $http->proxy_host = $this->host;
  36          $http->proxy_port = $this->port;
  37  
  38          $data = $http->get($this->url);
  39          $this->assertFalse($data === false, $http->errorInfo($this->url));
  40          $this->assertStringContainsString('DokuWiki', $data, 'response content');
  41      }
  42  }