Fix API tests

This commit is contained in:
Alejandro Celaya 2023-03-25 11:07:19 +01:00
parent 4dfc5ae681
commit 1d155298c1
5 changed files with 6 additions and 8 deletions

View File

@ -33,7 +33,6 @@ use function Shlinkio\Shlink\Core\enumValues;
use function Shlinkio\Shlink\Core\generateRandomShortCode;
use function Shlinkio\Shlink\Core\normalizeDate;
use function Shlinkio\Shlink\Core\normalizeOptionalDate;
use function str_contains;
class ShortUrl extends AbstractEntity
{

View File

@ -68,7 +68,7 @@ class ShortUrlInputFilter extends InputFilter
$deviceLongUrlsInput = $this->createInput(self::DEVICE_LONG_URLS, false);
$deviceLongUrlsInput->getValidatorChain()->attach(
new DeviceLongUrlsValidator($this->longUrlValidators(allowNull: ! $requireLongUrl))
new DeviceLongUrlsValidator($this->longUrlValidators(allowNull: ! $requireLongUrl)),
);
$this->add($deviceLongUrlsInput);

View File

@ -210,7 +210,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
self::assertSame(
$shortUrl,
$this->repo->findOneMatching(ShortUrlCreation::fromRawData(
['validSince' => $start, 'longUrl' => 'https://foo', 'tags' => ['foo', 'bar']]
['validSince' => $start, 'longUrl' => 'https://foo', 'tags' => ['foo', 'bar']],
)),
);
self::assertSame(

View File

@ -240,10 +240,9 @@ class TagRepositoryTest extends DatabaseTestCase
[$firstUrlTags, $secondUrlTags] = array_chunk($names, 3);
$shortUrl = ShortUrl::create(
ShortUrlCreation::fromRawData(['apiKey' => $authorApiKey, 'longUrl' => 'https://longUrl', 'tags' => $firstUrlTags]),
$this->relationResolver,
);
$shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData(
['apiKey' => $authorApiKey, 'longUrl' => 'https://longUrl', 'tags' => $firstUrlTags],
), $this->relationResolver);
$this->getEntityManager()->persist($shortUrl);
$shortUrl2 = ShortUrl::create(

View File

@ -96,7 +96,7 @@ class EditShortUrlTest extends ApiTestCase
public static function provideLongUrls(): iterable
{
yield 'valid URL' => ['https://shlink.io', self::STATUS_OK, null];
yield 'invalid URL' => ['htt:foo', self::STATUS_BAD_REQUEST, 'INVALID_URL'];
yield 'invalid URL' => ['http://foo', self::STATUS_BAD_REQUEST, 'INVALID_URL'];
}
#[Test, DataProvider('provideInvalidUrls')]