mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -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\generateRandomShortCode;
|
||||||
use function Shlinkio\Shlink\Core\normalizeDate;
|
use function Shlinkio\Shlink\Core\normalizeDate;
|
||||||
use function Shlinkio\Shlink\Core\normalizeOptionalDate;
|
use function Shlinkio\Shlink\Core\normalizeOptionalDate;
|
||||||
use function str_contains;
|
|
||||||
|
|
||||||
class ShortUrl extends AbstractEntity
|
class ShortUrl extends AbstractEntity
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ class ShortUrlInputFilter extends InputFilter
|
|||||||
|
|
||||||
$deviceLongUrlsInput = $this->createInput(self::DEVICE_LONG_URLS, false);
|
$deviceLongUrlsInput = $this->createInput(self::DEVICE_LONG_URLS, false);
|
||||||
$deviceLongUrlsInput->getValidatorChain()->attach(
|
$deviceLongUrlsInput->getValidatorChain()->attach(
|
||||||
new DeviceLongUrlsValidator($this->longUrlValidators(allowNull: ! $requireLongUrl))
|
new DeviceLongUrlsValidator($this->longUrlValidators(allowNull: ! $requireLongUrl)),
|
||||||
);
|
);
|
||||||
$this->add($deviceLongUrlsInput);
|
$this->add($deviceLongUrlsInput);
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ class ShortUrlRepositoryTest extends DatabaseTestCase
|
|||||||
self::assertSame(
|
self::assertSame(
|
||||||
$shortUrl,
|
$shortUrl,
|
||||||
$this->repo->findOneMatching(ShortUrlCreation::fromRawData(
|
$this->repo->findOneMatching(ShortUrlCreation::fromRawData(
|
||||||
['validSince' => $start, 'longUrl' => 'https://foo', 'tags' => ['foo', 'bar']]
|
['validSince' => $start, 'longUrl' => 'https://foo', 'tags' => ['foo', 'bar']],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
|
@ -240,10 +240,9 @@ class TagRepositoryTest extends DatabaseTestCase
|
|||||||
|
|
||||||
[$firstUrlTags, $secondUrlTags] = array_chunk($names, 3);
|
[$firstUrlTags, $secondUrlTags] = array_chunk($names, 3);
|
||||||
|
|
||||||
$shortUrl = ShortUrl::create(
|
$shortUrl = ShortUrl::create(ShortUrlCreation::fromRawData(
|
||||||
ShortUrlCreation::fromRawData(['apiKey' => $authorApiKey, 'longUrl' => 'https://longUrl', 'tags' => $firstUrlTags]),
|
['apiKey' => $authorApiKey, 'longUrl' => 'https://longUrl', 'tags' => $firstUrlTags],
|
||||||
$this->relationResolver,
|
), $this->relationResolver);
|
||||||
);
|
|
||||||
$this->getEntityManager()->persist($shortUrl);
|
$this->getEntityManager()->persist($shortUrl);
|
||||||
|
|
||||||
$shortUrl2 = ShortUrl::create(
|
$shortUrl2 = ShortUrl::create(
|
||||||
|
@ -96,7 +96,7 @@ class EditShortUrlTest extends ApiTestCase
|
|||||||
public static function provideLongUrls(): iterable
|
public static function provideLongUrls(): iterable
|
||||||
{
|
{
|
||||||
yield 'valid URL' => ['https://shlink.io', self::STATUS_OK, null];
|
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')]
|
#[Test, DataProvider('provideInvalidUrls')]
|
||||||
|
Loading…
Reference in New Issue
Block a user