From 5ddb6a7f992b67eeada0854470532330c5f5e42a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 18 Feb 2021 21:33:30 +0100 Subject: [PATCH] Added e2e tests covering shortening of twitter URLs with url validatio enabled --- .../test-api/Action/CreateShortUrlTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/module/Rest/test-api/Action/CreateShortUrlTest.php b/module/Rest/test-api/Action/CreateShortUrlTest.php index 868ad142..e9768a69 100644 --- a/module/Rest/test-api/Action/CreateShortUrlTest.php +++ b/module/Rest/test-api/Action/CreateShortUrlTest.php @@ -297,6 +297,24 @@ class CreateShortUrlTest extends ApiTestCase yield 'example domain' => ['example.com']; } + /** + * @test + * @dataProvider provideTwitterUrls + */ + public function urlsWithBothProtectionCanBeShortenedWithUrlValidationEnabled(string $longUrl): void + { + [$statusCode] = $this->createShortUrl(['longUrl' => $longUrl, 'validateUrl' => true]); + self::assertEquals(self::STATUS_OK, $statusCode); + } + + public function provideTwitterUrls(): iterable + { + yield ['https://twitter.com/shlinkio']; + yield ['https://mobile.twitter.com/shlinkio']; + yield ['https://twitter.com/shlinkio/status/1360637738421268481']; + yield ['https://mobile.twitter.com/shlinkio/status/1360637738421268481']; + } + /** * @return array { * @var int $statusCode