mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-22 08:56:42 -06:00
Fix API tests
This commit is contained in:
parent
4dfc5ae681
commit
1d155298c1
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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')]
|
||||
|
Loading…
Reference in New Issue
Block a user