Skip to content

Commit 465ff81

Browse files
committed
Fix test with different curl errors
1 parent c9583dd commit 465ff81

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

tests/ClientTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,19 @@ public function testRunError() : void
9999
try {
100100
$this->client->run($request);
101101
} catch (RequestException $exception) {
102-
self::assertSame(
102+
$expected = \str_starts_with($exception->getMessage(), 'Could')
103+
? 0
104+
: 1;
105+
$messages = [
106+
'Could not resolve host: domain.tld',
103107
'Failed to connect to domain.tld port 80: No route to host',
104-
$exception->getMessage()
105-
);
106-
self::assertSame(7, $exception->getCode());
108+
];
109+
$codes = [
110+
6,
111+
7,
112+
];
113+
self::assertSame($messages[$expected], $exception->getMessage());
114+
self::assertSame($codes[$expected], $exception->getCode());
107115
self::assertEmpty($exception->getInfo());
108116
}
109117
}

0 commit comments

Comments
 (0)