mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 04:01:47 +00:00
Merge pull request #520 from zachborboa/master
Fix tests failing due to unexpected network error code
This commit is contained in:
@@ -1106,9 +1106,15 @@ class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
$test->curl->get(Test::ERROR_URL);
|
||||
$this->assertTrue($test->curl->error);
|
||||
$this->assertTrue($test->curl->curlError);
|
||||
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED);
|
||||
$this->assertTrue(in_array($test->curl->errorCode, $possible_errors, true));
|
||||
$this->assertTrue(in_array($test->curl->curlErrorCode, $possible_errors, true));
|
||||
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT);
|
||||
$this->assertTrue(
|
||||
in_array($test->curl->errorCode, $possible_errors, true),
|
||||
'errorCode: ' . $test->curl->errorCode
|
||||
);
|
||||
$this->assertTrue(
|
||||
in_array($test->curl->curlErrorCode, $possible_errors, true),
|
||||
'curlErrorCode: ' . $test->curl->curlErrorCode
|
||||
);
|
||||
}
|
||||
|
||||
public function testErrorMessage()
|
||||
|
||||
@@ -601,9 +601,15 @@ class MultiCurlTest extends \PHPUnit\Framework\TestCase
|
||||
\PHPUnit\Framework\Assert::assertTrue($instance->error);
|
||||
\PHPUnit\Framework\Assert::assertTrue($instance->curlError);
|
||||
\PHPUnit\Framework\Assert::assertFalse($instance->httpError);
|
||||
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED);
|
||||
\PHPUnit\Framework\Assert::assertTrue(in_array($instance->errorCode, $possible_errors, true));
|
||||
\PHPUnit\Framework\Assert::assertTrue(in_array($instance->curlErrorCode, $possible_errors, true));
|
||||
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED, CURLE_COULDNT_CONNECT);
|
||||
\PHPUnit\Framework\Assert::assertTrue(
|
||||
in_array($instance->errorCode, $possible_errors, true),
|
||||
'errorCode: ' . $instance->errorCode
|
||||
);
|
||||
\PHPUnit\Framework\Assert::assertTrue(
|
||||
in_array($instance->curlErrorCode, $possible_errors, true),
|
||||
'curlErrorCode: ' . $instance->curlErrorCode
|
||||
);
|
||||
});
|
||||
|
||||
$multi_curl->addDelete(Test::ERROR_URL);
|
||||
|
||||
Reference in New Issue
Block a user