Skip to content

Commit 33a3dbf

Browse files
committed
🚿
1 parent 00c60c9 commit 33a3dbf

File tree

6 files changed

+39
-35
lines changed

6 files changed

+39
-35
lines changed

tests/Psr18/CurlClientNoCATest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15-
use chillerlan\HTTP\{HTTPOptions, Psr18\CurlClient};
15+
use chillerlan\HTTP\Psr18\CurlClient;
1616

1717
class CurlClientNoCATest extends HTTPClientTestAbstract{
1818

1919
protected function setUp():void{
20-
$options = new HTTPOptions([
21-
'ssl_verifypeer' => false,
22-
'user_agent' => $this::USER_AGENT,
23-
]);
20+
parent::setUp();
2421

25-
$this->http = new CurlClient($options);
22+
$this->options->ca_info = null;
23+
$this->options->ssl_verifypeer = false;
24+
25+
$this->http = new CurlClient($this->options);
2626
}
2727

2828
}

tests/Psr18/CurlClientTest.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15-
use chillerlan\HTTP\{HTTPOptions, Psr18\CurlClient, Psr18\RequestException, Psr7\Request};
15+
use chillerlan\HTTP\Psr18\{CurlClient, RequestException};
16+
use chillerlan\HTTP\Psr7\Request;
1617

1718
class CurlClientTest extends HTTPClientTestAbstract{
1819

1920
protected function setUp():void{
20-
$options = new HTTPOptions([
21-
'ca_info' => __DIR__.'/../cacert.pem',
22-
'user_agent' => $this::USER_AGENT,
23-
]);
21+
parent::setUp();
2422

25-
$this->http = new CurlClient($options);
23+
$this->http = new CurlClient($this->options);
2624
}
2725

2826
public function testRequestError(){

tests/Psr18/HTTPClientTestAbstract.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15+
use chillerlan\HTTP\HTTPOptions;
1516
use chillerlan\HTTP\Psr7\Request;
1617
use Exception;
1718
use PHPUnit\Framework\TestCase;
@@ -23,6 +24,20 @@ abstract class HTTPClientTestAbstract extends TestCase{
2324

2425
protected const USER_AGENT = 'chillerlanHttpTest/2.0';
2526

27+
/**
28+
* @var \chillerlan\HTTP\HTTPOptions
29+
*/
30+
protected $options;
31+
32+
protected function setUp():void{
33+
34+
$this->options = new HTTPOptions([
35+
'ca_info' => __DIR__.'/../cacert.pem',
36+
'user_agent' => $this::USER_AGENT,
37+
]);
38+
39+
}
40+
2641
/**
2742
* @var \Psr\Http\Client\ClientInterface
2843
*/

tests/Psr18/StreamClientNoCATest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15-
use chillerlan\HTTP\{HTTPOptions, Psr18\StreamClient};
15+
use chillerlan\HTTP\Psr18\StreamClient;
1616

1717
class StreamClientNoCATest extends HTTPClientTestAbstract{
1818

1919
protected function setUp():void{
20-
$options = new HTTPOptions([
21-
'ssl_verifypeer' => false,
22-
'user_agent' => $this::USER_AGENT,
23-
]);
20+
parent::setUp();
2421

25-
$this->http = new StreamClient($options);
22+
$this->options->ca_info = null;
23+
$this->options->ssl_verifypeer = false;
24+
25+
$this->http = new StreamClient($this->options);
2626
}
2727

2828
}

tests/Psr18/StreamClientTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15-
use chillerlan\HTTP\{HTTPOptions, Psr18\StreamClient};
15+
use chillerlan\HTTP\Psr18\StreamClient;
1616

1717
class StreamClientTest extends HTTPClientTestAbstract{
1818

1919
protected function setUp():void{
20-
$options = new HTTPOptions([
21-
'ca_info' => __DIR__.'/../cacert.pem',
22-
'user_agent' => $this::USER_AGENT,
23-
]);
20+
parent::setUp();
2421

25-
$this->http = new StreamClient($options);
22+
$this->http = new StreamClient($this->options);
2623
}
2724

2825
}

tests/Psr18/URLExtractorTest.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
namespace chillerlan\HTTPTest\Psr18;
1414

15-
use chillerlan\HTTP\HTTPOptions;
1615
use chillerlan\HTTP\Psr18\URLExtractor;
1716
use chillerlan\HTTP\Psr7\Request;
1817

@@ -24,17 +23,12 @@
2423
class URLExtractorTest extends HTTPClientTestAbstract{
2524

2625
protected function setUp():void{
27-
$options = new HTTPOptions([
28-
'ca_info' => __DIR__.'/../cacert.pem',
29-
'user_agent' => $this::USER_AGENT,
30-
'curl_options' => [
31-
CURLOPT_FOLLOWLOCATION => false,
32-
]
33-
]);
34-
35-
$this->http = new URLExtractor($options);
36-
}
26+
parent::setUp();
27+
28+
$this->options->curl_options = [CURLOPT_FOLLOWLOCATION => false];
3729

30+
$this->http = new URLExtractor($this->options);
31+
}
3832

3933
public function testSendRequest(){
4034
$this->markTestSkipped('i have no idea why the headers are empty on travis');

0 commit comments

Comments
 (0)