Skip to content

Commit

Permalink
Use $transport::test() for checking SSL in tests
Browse files Browse the repository at this point in the history
See #101. Turns out fsockopen was overriding this, but we have contextual
checking support now, so let's use that.
  • Loading branch information
rmccue committed Mar 23, 2014
1 parent 5072e6e commit dfafa2c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 9 additions & 1 deletion tests/Transport/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@

abstract class RequestsTest_Transport_Base extends PHPUnit_Framework_TestCase {
public function setUp() {
if (!call_user_func(array($this->transport, 'test'))) {
$callback = array($this->transport, 'test');
$supported = call_user_func($callback);

if (!$supported) {
$this->markTestSkipped($this->transport . ' is not available');
return;
}

$ssl_supported = call_user_func($callback, array('ssl' => true));
if (!$ssl_supported) {
$this->skip_https = true;
}
}
protected $skip_https = false;

Expand Down
8 changes: 0 additions & 8 deletions tests/Transport/fsockopen.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@

class RequestsTest_Transport_fsockopen extends RequestsTest_Transport_Base {
protected $transport = 'Requests_Transport_fsockopen';

protected $skip_https = false;
public function setUp() {
// If OpenSSL isn't loaded, this should fail
if (!defined('OPENSSL_VERSION_NUMBER')) {
$this->skip_https = true;
}
}
}

0 comments on commit dfafa2c

Please sign in to comment.