Added new test for the case in which an invalid URL is provided

This commit is contained in:
Alejandro Celaya 2019-11-26 21:33:22 +01:00
parent 509c9fe2e8
commit f502eb0195

View File

@ -200,6 +200,15 @@ class CreateShortUrlActionTest extends ApiTestCase
yield ['http://téstb.shlink.io']; // Redirects to http://tést.shlink.io
}
/** @test */
public function failsToCreateShortUrlWithInvalidOriginalUrl(): void
{
[$statusCode, $payload] = $this->createShortUrl(['longUrl' => 'https://this-has-to-be-invalid.com']);
$this->assertEquals(self::STATUS_BAD_REQUEST, $statusCode);
$this->assertEquals('INVALID_URL', $payload['error']);
}
/**
* @return array {
* @var int $statusCode