Skip to content

Commit d736b56

Browse files
committed
Add assertion messages to display unexpected error codes
1 parent bab7ee9 commit d736b56

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,8 +1107,14 @@ public function testError()
11071107
$this->assertTrue($test->curl->error);
11081108
$this->assertTrue($test->curl->curlError);
11091109
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED);
1110-
$this->assertTrue(in_array($test->curl->errorCode, $possible_errors, true));
1111-
$this->assertTrue(in_array($test->curl->curlErrorCode, $possible_errors, true));
1110+
$this->assertTrue(
1111+
in_array($test->curl->errorCode, $possible_errors, true),
1112+
'errorCode: ' . $test->curl->errorCode
1113+
);
1114+
$this->assertTrue(
1115+
in_array($test->curl->curlErrorCode, $possible_errors, true),
1116+
'curlErrorCode: ' . $test->curl->curlErrorCode
1117+
);
11121118
}
11131119

11141120
public function testErrorMessage()

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,14 @@ public function testMultiCurlCallbackError()
602602
\PHPUnit\Framework\Assert::assertTrue($instance->curlError);
603603
\PHPUnit\Framework\Assert::assertFalse($instance->httpError);
604604
$possible_errors = array(CURLE_SEND_ERROR, CURLE_OPERATION_TIMEOUTED);
605-
\PHPUnit\Framework\Assert::assertTrue(in_array($instance->errorCode, $possible_errors, true));
606-
\PHPUnit\Framework\Assert::assertTrue(in_array($instance->curlErrorCode, $possible_errors, true));
605+
\PHPUnit\Framework\Assert::assertTrue(
606+
in_array($instance->errorCode, $possible_errors, true),
607+
'errorCode: ' . $instance->errorCode
608+
);
609+
\PHPUnit\Framework\Assert::assertTrue(
610+
in_array($instance->curlErrorCode, $possible_errors, true),
611+
'curlErrorCode: ' . $instance->curlErrorCode
612+
);
607613
});
608614

609615
$multi_curl->addDelete(Test::ERROR_URL);

0 commit comments

Comments
 (0)