Skip to content

Commit 90f4552

Browse files
committed
Fix failure tests erroring during continuous integration tests with mismatching error codes.
Fixes "Failed asserting that 28 matches expected 55."
1 parent 027ee67 commit 90f4552

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

tests/PHPCurlClass/PHPCurlClassTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,8 +1106,9 @@ public function testError()
11061106
$test->curl->get(Test::ERROR_URL);
11071107
$this->assertTrue($test->curl->error);
11081108
$this->assertTrue($test->curl->curlError);
1109-
$this->assertEquals(CURLE_SEND_ERROR, $test->curl->errorCode);
1110-
$this->assertEquals(CURLE_SEND_ERROR, $test->curl->curlErrorCode);
1109+
$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));
11111112
}
11121113

11131114
public function testErrorMessage()

tests/PHPCurlClass/PHPMultiCurlClassTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,9 @@ public function testMultiCurlCallbackError()
601601
\PHPUnit\Framework\Assert::assertTrue($instance->error);
602602
\PHPUnit\Framework\Assert::assertTrue($instance->curlError);
603603
\PHPUnit\Framework\Assert::assertFalse($instance->httpError);
604-
\PHPUnit\Framework\Assert::assertEquals(CURLE_SEND_ERROR, $instance->errorCode);
605-
\PHPUnit\Framework\Assert::assertEquals(CURLE_SEND_ERROR, $instance->curlErrorCode);
604+
$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));
606607
});
607608

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

0 commit comments

Comments
 (0)