Converted DeleteShortUrlException into a problem details exception

This commit is contained in:
Alejandro Celaya
2019-11-24 23:56:02 +01:00
parent 32b3c72bdf
commit 310032e303
5 changed files with 24 additions and 58 deletions
@@ -20,7 +20,7 @@ class DeleteShortUrlActionTest extends ApiTestCase
}
/** @test */
public function badRequestIsReturnedWhenTryingToDeleteUrlWithTooManyVisits(): void
public function unprocessableEntityIsReturnedWhenTryingToDeleteUrlWithTooManyVisits(): void
{
// Generate visits first
for ($i = 0; $i < 20; $i++) {
@@ -30,7 +30,7 @@ class DeleteShortUrlActionTest extends ApiTestCase
$resp = $this->callApiWithKey(self::METHOD_DELETE, '/short-urls/abc123');
['error' => $error] = $this->getJsonResponsePayload($resp);
$this->assertEquals(self::STATUS_BAD_REQUEST, $resp->getStatusCode());
$this->assertEquals(self::STATUS_UNPROCESSABLE_ENTITY, $resp->getStatusCode());
$this->assertEquals(RestUtils::INVALID_SHORTCODE_DELETION_ERROR, $error);
}
}