in util/ActionTest.php [180:223]
private function catch(string $action, array &$vars)
{
switch ($action) {
case 'bad_request':
$expectedException = BadRequest400Exception::class;
break;
case 'unauthorized':
$expectedException = Unauthorized401Exception::class;
break;
case 'forbidden':
$expectedException = Forbidden403Exception::class;
break;
case 'missing':
$expectedException = Missing404Exception::class;
break;
case 'request_timeout':
$expectedException = RequestTimeout408Exception::class;
break;
case 'conflict':
$expectedException = Conflict409Exception::class;
break;
case 'request':
$expectedException = OpenSearchException::class;
break;
case 'unavailable':
$expectedException = OpenSearchException::class;
$scriptException = YamlTests::render(self::TEMPLATE_CATCH_UNAVAILABLE);
break;
case 'param':
$expectedException = OpenSearchException::class;
$scriptException = 'var_dump($response);';
break;
default:
$expectedException = OpenSearchException::class;
$scriptException = YamlTests::render(
($this->phpUnitVersion > 8) ? (self::TEMPLATE_PHPUNIT9_CATCH_REGEX) : (self::TEMPLATE_CATCH_REGEX),
[ ':regex' => sprintf("'%s'", addslashes($action)) ]
);
}
$vars[':catch'] = YamlTests::render(self::TEMPLATE_CATCH, [
':exception' => $expectedException
]);
$vars[':response-check'] .= $scriptException ?? '';
}