Improved api tests where a short URL needs to be resolved, covering cases where API key lacks permissions

This commit is contained in:
Alejandro Celaya
2021-01-10 09:02:05 +01:00
parent f17873b527
commit ea05259bbe
6 changed files with 37 additions and 13 deletions

View File

@@ -104,10 +104,11 @@ class EditShortUrlActionTest extends ApiTestCase
public function tryingToEditInvalidUrlReturnsNotFoundError(
string $shortCode,
?string $domain,
string $expectedDetail
string $expectedDetail,
string $apiKey
): void {
$url = $this->buildShortUrlPath($shortCode, $domain);
$resp = $this->callApiWithKey(self::METHOD_PATCH, $url, [RequestOptions::JSON => []]);
$resp = $this->callApiWithKey(self::METHOD_PATCH, $url, [RequestOptions::JSON => []], $apiKey);
$payload = $this->getJsonResponsePayload($resp);
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());