diff --git a/module/Rest/test-api/Action/CreateShortUrlActionTest.php b/module/Rest/test-api/Action/CreateShortUrlActionTest.php index 9ec8e8e2..79b7ba1e 100644 --- a/module/Rest/test-api/Action/CreateShortUrlActionTest.php +++ b/module/Rest/test-api/Action/CreateShortUrlActionTest.php @@ -228,6 +228,22 @@ class CreateShortUrlActionTest extends ApiTestCase $this->assertEquals($url, $payload['url']); } + /** @test */ + public function defaultDomainIsDroppedIfProvided(): void + { + [$createStatusCode, ['shortCode' => $shortCode]] = $this->createShortUrl([ + 'longUrl' => 'https://www.alejandrocelaya.com', + 'domain' => 'doma.in', + ]); + $getResp = $this->callApiWithKey(self::METHOD_GET, '/short-urls/' . $shortCode); + $payload = $this->getJsonResponsePayload($getResp); + + $this->assertEquals(self::STATUS_OK, $createStatusCode); + $this->assertEquals(self::STATUS_OK, $getResp->getStatusCode()); + $this->assertArrayHasKey('domain', $payload); + $this->assertNull($payload['domain']); + } + /** * @return array { * @var int $statusCode