i have a function im testing which suppose to return error 500 but after adding 'http_errors' => 'false'
to the put
definition, the returned error changes from 500 to 404.
this is my function:
public function testApiAd_updateWithIllegalGroupId($adId)
{
$client = new Client(['base_uri' => self::$base_url]);
try {
$response = $client->put(self::$path.$adId, ['form_params' => [
'name' => 'bellow content - guzzle testing',
'description' => 'guzzle testing ad - demo',
'group_id' => '999999999',
]]);
} catch (Guzzle\Http\Exception\BadResponseException $e) {
//Here i want to compare received error to 500
}
}
right now this function will return server error: 500
but it also stops the class from executing rest of the tests and i can't assert it.
how can i use the guzzle getStatusCode()
in my function while getting error 500 and not 404 as i mentioned above