Полное покрытие тестами классов AtolClient + KktMonitor + половины исключений

Часть тестов завязаны на тестовый API мониторинга Атола. Иногда он закашливается и не отвечает, возможно, там рейтлимит. Да и пофиг, моки -- злейшее зло, и мне лень их писать.
This commit is contained in:
2021-11-19 18:42:14 +08:00
parent 2c5144caac
commit 6551366d84
2 changed files with 79 additions and 11 deletions

View File

@@ -28,12 +28,17 @@ class BasicTestCase extends TestCase
* @param string $url
* @param int $code
* @return bool
* @throws GuzzleException
*/
protected function ping(string $url, int $code): bool
{
$result = (new Client(['http_errors' => false]))->request('GET', $url);
//$this->assertEquals(200, $result->getStatusCode());
try {
$result = (new Client([
'http_errors' => false,
'timeout' => 3,
]))->request('GET', $url);
} catch (GuzzleException) {
return false;
}
return $result->getStatusCode() === $code;
}