mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Added more strict checks on API errors tests
This commit is contained in:
@@ -11,10 +11,18 @@ class ResolveShortUrlActionTest extends ApiTestCase
|
||||
/** @test */
|
||||
public function tryingToResolveInvalidUrlReturnsNotFoundError(): void
|
||||
{
|
||||
$expectedDetail = 'No URL found with short code "invalid"';
|
||||
|
||||
$resp = $this->callApiWithKey(self::METHOD_GET, '/short-urls/invalid');
|
||||
['error' => $error] = $this->getJsonResponsePayload($resp);
|
||||
$payload = $this->getJsonResponsePayload($resp);
|
||||
|
||||
$this->assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
$this->assertEquals('INVALID_SHORTCODE', $error);
|
||||
$this->assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
$this->assertEquals('INVALID_SHORTCODE', $payload['type']);
|
||||
$this->assertEquals('INVALID_SHORTCODE', $payload['error']); // Deprecated
|
||||
$this->assertEquals($expectedDetail, $payload['detail']);
|
||||
$this->assertEquals($expectedDetail, $payload['message']); // Deprecated
|
||||
$this->assertEquals('Short URL not found', $payload['title']);
|
||||
$this->assertEquals('invalid', $payload['shortCode']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user