Skip to content

Commit 6380d1d

Browse files
committed
Use $transport::test() for checking SSL in tests
See #101. Turns out fsockopen was overriding this, but we have contextual checking support now, so let's use that.
1 parent 8d15afb commit 6380d1d

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

tests/Transport/Base.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22

33
abstract class RequestsTest_Transport_Base extends PHPUnit_Framework_TestCase {
44
public function setUp() {
5-
if (!call_user_func(array($this->transport, 'test'))) {
5+
$callback = array($this->transport, 'test');
6+
$supported = call_user_func($callback);
7+
8+
if (!$supported) {
69
$this->markTestSkipped($this->transport . ' is not available');
710
return;
811
}
12+
13+
$ssl_supported = call_user_func($callback, array('ssl' => true));
14+
if (!$ssl_supported) {
15+
$this->skip_https = true;
16+
}
917
}
1018
protected $skip_https = false;
1119

tests/Transport/fsockopen.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,4 @@
22

33
class RequestsTest_Transport_fsockopen extends RequestsTest_Transport_Base {
44
protected $transport = 'Requests_Transport_fsockopen';
5-
6-
protected $skip_https = false;
7-
public function setUp() {
8-
// If OpenSSL isn't loaded, this should fail
9-
if (!defined('OPENSSL_VERSION_NUMBER')) {
10-
$this->skip_https = true;
11-
}
12-
}
135
}

0 commit comments

Comments
 (0)