mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Removed deprecated features
This commit is contained in:
@@ -19,7 +19,7 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
#[Test]
|
||||
public function createsNewShortUrlWhenOnlyLongUrlIsProvided(): void
|
||||
{
|
||||
$expectedKeys = ['shortCode', 'shortUrl', 'longUrl', 'dateCreated', 'visitsCount', 'tags'];
|
||||
$expectedKeys = ['shortCode', 'shortUrl', 'longUrl', 'dateCreated', 'tags'];
|
||||
[$statusCode, $payload] = $this->createShortUrl();
|
||||
|
||||
self::assertEquals(self::STATUS_OK, $statusCode);
|
||||
@@ -48,7 +48,7 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $statusCode);
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $payload['status']);
|
||||
self::assertEquals($detail, $payload['detail']);
|
||||
self::assertEquals('INVALID_SLUG', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/non-unique-slug', $payload['type']);
|
||||
self::assertEquals('Invalid custom slug', $payload['title']);
|
||||
self::assertEquals($slug, $payload['customSlug']);
|
||||
|
||||
@@ -70,8 +70,8 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
|
||||
public static function provideDuplicatedSlugApiVersions(): iterable
|
||||
{
|
||||
yield ['1', 'INVALID_SLUG'];
|
||||
yield ['2', 'INVALID_SLUG'];
|
||||
yield ['1', 'https://shlink.io/api/error/non-unique-slug'];
|
||||
yield ['2', 'https://shlink.io/api/error/non-unique-slug'];
|
||||
yield ['3', 'https://shlink.io/api/error/non-unique-slug'];
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
|
||||
public static function provideInvalidUrls(): iterable
|
||||
{
|
||||
yield 'API version 2' => ['https://this-has-to-be-invalid.com', '2', 'INVALID_URL'];
|
||||
yield 'API version 2' => ['https://this-has-to-be-invalid.com', '2', 'https://shlink.io/api/error/invalid-url'];
|
||||
yield 'API version 3' => ['https://this-has-to-be-invalid.com', '3', 'https://shlink.io/api/error/invalid-url'];
|
||||
}
|
||||
|
||||
@@ -264,18 +264,18 @@ class CreateShortUrlTest extends ApiTestCase
|
||||
|
||||
public static function provideInvalidArgumentApiVersions(): iterable
|
||||
{
|
||||
yield 'missing long url v2' => [[], '2', 'INVALID_ARGUMENT'];
|
||||
yield 'missing long url v2' => [[], '2', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'missing long url v3' => [[], '3', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'empty long url v2' => [['longUrl' => null], '2', 'INVALID_ARGUMENT'];
|
||||
yield 'empty long url v2' => [['longUrl' => null], '2', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'empty long url v3' => [['longUrl' => ' '], '3', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'missing url schema v2' => [['longUrl' => 'foo.com'], '2', 'INVALID_ARGUMENT'];
|
||||
yield 'missing url schema v2' => [['longUrl' => 'foo.com'], '2', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'missing url schema v3' => [['longUrl' => 'foo.com'], '3', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'empty device long url v2' => [[
|
||||
'longUrl' => 'foo',
|
||||
'deviceLongUrls' => [
|
||||
'android' => null,
|
||||
],
|
||||
], '2', 'INVALID_ARGUMENT'];
|
||||
], '2', 'https://shlink.io/api/error/invalid-data'];
|
||||
yield 'empty device long url v3' => [[
|
||||
'longUrl' => 'foo',
|
||||
'deviceLongUrls' => [
|
||||
|
||||
@@ -31,7 +31,7 @@ class DeleteShortUrlTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('INVALID_SHORTCODE', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/short-url-not-found', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Short URL not found', $payload['title']);
|
||||
self::assertEquals($shortCode, $payload['shortCode']);
|
||||
@@ -52,8 +52,8 @@ class DeleteShortUrlTest extends ApiTestCase
|
||||
|
||||
public static function provideApiVersions(): iterable
|
||||
{
|
||||
yield ['1', 'INVALID_SHORTCODE'];
|
||||
yield ['2', 'INVALID_SHORTCODE'];
|
||||
yield ['1', 'https://shlink.io/api/error/short-url-not-found'];
|
||||
yield ['2', 'https://shlink.io/api/error/short-url-not-found'];
|
||||
yield ['3', 'https://shlink.io/api/error/short-url-not-found'];
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ class DeleteTagsTest extends ApiTestCase
|
||||
|
||||
public static function provideNonAdminApiKeys(): iterable
|
||||
{
|
||||
yield 'author' => ['author_api_key', '2', 'FORBIDDEN_OPERATION'];
|
||||
yield 'domain' => ['domain_api_key', '2', 'FORBIDDEN_OPERATION'];
|
||||
yield 'author' => ['author_api_key', '2', 'https://shlink.io/api/error/forbidden-tag-operation'];
|
||||
yield 'domain' => ['domain_api_key', '2', 'https://shlink.io/api/error/forbidden-tag-operation'];
|
||||
yield 'version 3' => ['domain_api_key', '3', 'https://shlink.io/api/error/forbidden-tag-operation'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class DomainRedirectsTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $payload['status']);
|
||||
self::assertEquals('INVALID_ARGUMENT', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/invalid-data', $payload['type']);
|
||||
self::assertEquals('Provided data is not valid', $payload['detail']);
|
||||
self::assertEquals('Invalid data', $payload['title']);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class DomainVisitsTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('DOMAIN_NOT_FOUND', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/domain-not-found', $payload['type']);
|
||||
self::assertEquals(sprintf('Domain with authority "%s" could not be found', $domain), $payload['detail']);
|
||||
self::assertEquals('Domain not found', $payload['title']);
|
||||
self::assertEquals($domain, $payload['authority']);
|
||||
@@ -73,8 +73,8 @@ class DomainVisitsTest extends ApiTestCase
|
||||
|
||||
public static function provideApiVersions(): iterable
|
||||
{
|
||||
yield ['1', 'DOMAIN_NOT_FOUND'];
|
||||
yield ['2', 'DOMAIN_NOT_FOUND'];
|
||||
yield ['1', 'https://shlink.io/api/error/domain-not-found'];
|
||||
yield ['2', 'https://shlink.io/api/error/domain-not-found'];
|
||||
yield ['3', 'https://shlink.io/api/error/domain-not-found'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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' => ['http://foo', self::STATUS_BAD_REQUEST, 'INVALID_URL'];
|
||||
yield 'invalid URL' => ['http://foo', self::STATUS_BAD_REQUEST, 'https://shlink.io/api/error/invalid-url'];
|
||||
}
|
||||
|
||||
#[Test, DataProviderExternal(ApiTestDataProviders::class, 'invalidUrlsProvider')]
|
||||
@@ -112,7 +112,7 @@ class EditShortUrlTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('INVALID_SHORTCODE', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/short-url-not-found', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Short URL not found', $payload['title']);
|
||||
self::assertEquals($shortCode, $payload['shortCode']);
|
||||
@@ -131,7 +131,7 @@ class EditShortUrlTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $payload['status']);
|
||||
self::assertEquals('INVALID_ARGUMENT', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/invalid-data', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Invalid data', $payload['title']);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,8 @@ class GlobalVisitsTest extends ApiTestCase
|
||||
$payload = $this->getJsonResponsePayload($resp);
|
||||
|
||||
self::assertArrayHasKey('visits', $payload);
|
||||
self::assertArrayHasKey('visitsCount', $payload['visits']);
|
||||
self::assertArrayHasKey('orphanVisitsCount', $payload['visits']);
|
||||
self::assertEquals($expectedVisits, $payload['visits']['visitsCount']);
|
||||
self::assertEquals($expectedOrphanVisits, $payload['visits']['orphanVisitsCount']);
|
||||
self::assertEquals($expectedVisits, $payload['visits']['nonOrphanVisits']['total']);
|
||||
self::assertEquals($expectedOrphanVisits, $payload['visits']['orphanVisits']['total']);
|
||||
}
|
||||
|
||||
public static function provideApiKeys(): iterable
|
||||
|
||||
@@ -20,7 +20,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'shortUrl' => 'http://s.test/abc123',
|
||||
'longUrl' => 'https://shlink.io',
|
||||
'dateCreated' => '2018-05-01T00:00:00+00:00',
|
||||
'visitsCount' => 3,
|
||||
'visitsSummary' => [
|
||||
'total' => 3,
|
||||
'nonBots' => 3,
|
||||
@@ -42,7 +41,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'shortUrl' => 'http://s.test/ghi789',
|
||||
'longUrl' => 'https://shlink.io/documentation/',
|
||||
'dateCreated' => '2018-05-01T00:00:00+00:00',
|
||||
'visitsCount' => 2,
|
||||
'visitsSummary' => [
|
||||
'total' => 2,
|
||||
'nonBots' => 2,
|
||||
@@ -64,7 +62,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'shortUrl' => 'http://some-domain.com/custom-with-domain',
|
||||
'longUrl' => 'https://google.com',
|
||||
'dateCreated' => '2018-10-20T00:00:00+00:00',
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
@@ -88,7 +85,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'https://blog.alejandrocelaya.com/2017/12/09'
|
||||
. '/acmailer-7-0-the-most-important-release-in-a-long-time/',
|
||||
'dateCreated' => '2019-01-01T00:00:10+00:00',
|
||||
'visitsCount' => 2,
|
||||
'visitsSummary' => [
|
||||
'total' => 2,
|
||||
'nonBots' => 1,
|
||||
@@ -110,7 +106,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'shortUrl' => 'http://s.test/custom',
|
||||
'longUrl' => 'https://shlink.io',
|
||||
'dateCreated' => '2019-01-01T00:00:20+00:00',
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
@@ -134,7 +129,6 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
'https://blog.alejandrocelaya.com/2019/04/27'
|
||||
. '/considerations-to-properly-use-open-source-software-projects/',
|
||||
'dateCreated' => '2019-01-01T00:00:30+00:00',
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
@@ -310,7 +304,7 @@ class ListShortUrlsTest extends ApiTestCase
|
||||
self::assertEquals([
|
||||
'invalidElements' => $expectedInvalidElements,
|
||||
'title' => 'Invalid data',
|
||||
'type' => 'INVALID_ARGUMENT',
|
||||
'type' => 'https://shlink.io/api/error/invalid-data',
|
||||
'status' => 400,
|
||||
'detail' => 'Provided data is not valid',
|
||||
], $respPayload);
|
||||
|
||||
@@ -24,7 +24,7 @@ class RenameTagTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_FORBIDDEN, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_FORBIDDEN, $payload['status']);
|
||||
self::assertEquals('FORBIDDEN_OPERATION', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/forbidden-tag-operation', $payload['type']);
|
||||
self::assertEquals('You are not allowed to rename tags', $payload['detail']);
|
||||
self::assertEquals('Forbidden tag operation', $payload['title']);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class ResolveShortUrlTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('INVALID_SHORTCODE', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/short-url-not-found', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Short URL not found', $payload['title']);
|
||||
self::assertEquals($shortCode, $payload['shortCode']);
|
||||
|
||||
@@ -34,7 +34,7 @@ class ShortUrlVisitsTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('INVALID_SHORTCODE', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/short-url-not-found', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Short URL not found', $payload['title']);
|
||||
self::assertEquals($shortCode, $payload['shortCode']);
|
||||
|
||||
@@ -38,7 +38,7 @@ class SingleStepCreateShortUrlTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_UNAUTHORIZED, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_UNAUTHORIZED, $payload['status']);
|
||||
self::assertEquals('INVALID_AUTHORIZATION', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/missing-authentication', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Invalid authorization', $payload['title']);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class TagVisitsTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_NOT_FOUND, $payload['status']);
|
||||
self::assertEquals('TAG_NOT_FOUND', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/tag-not-found', $payload['type']);
|
||||
self::assertEquals(sprintf('Tag with name "%s" could not be found', $tag), $payload['detail']);
|
||||
self::assertEquals('Tag not found', $payload['title']);
|
||||
}
|
||||
|
||||
@@ -25,29 +25,12 @@ class TagsStatsTest extends ApiTestCase
|
||||
self::assertEquals($expectedPagination, $tags['pagination']);
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideQueries')]
|
||||
public function expectedListOfTagsIsReturnedForDeprecatedApproach(
|
||||
string $apiKey,
|
||||
array $query,
|
||||
array $expectedStats,
|
||||
array $expectedPagination,
|
||||
): void {
|
||||
$query['withStats'] = 'true';
|
||||
$resp = $this->callApiWithKey(self::METHOD_GET, '/tags', [RequestOptions::QUERY => $query], $apiKey);
|
||||
['tags' => $tags] = $this->getJsonResponsePayload($resp);
|
||||
|
||||
self::assertEquals($expectedStats, $tags['stats']);
|
||||
self::assertEquals($expectedPagination, $tags['pagination']);
|
||||
self::assertArrayHasKey('data', $tags);
|
||||
}
|
||||
|
||||
public static function provideQueries(): iterable
|
||||
{
|
||||
yield 'admin API key' => ['valid_api_key', [], [
|
||||
[
|
||||
'tag' => 'bar',
|
||||
'shortUrlsCount' => 1,
|
||||
'visitsCount' => 2,
|
||||
'visitsSummary' => [
|
||||
'total' => 2,
|
||||
'nonBots' => 1,
|
||||
@@ -57,7 +40,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'baz',
|
||||
'shortUrlsCount' => 0,
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
@@ -67,7 +49,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'foo',
|
||||
'shortUrlsCount' => 3,
|
||||
'visitsCount' => 5,
|
||||
'visitsSummary' => [
|
||||
'total' => 5,
|
||||
'nonBots' => 4,
|
||||
@@ -85,7 +66,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'bar',
|
||||
'shortUrlsCount' => 1,
|
||||
'visitsCount' => 2,
|
||||
'visitsSummary' => [
|
||||
'total' => 2,
|
||||
'nonBots' => 1,
|
||||
@@ -95,7 +75,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'baz',
|
||||
'shortUrlsCount' => 0,
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
@@ -113,7 +92,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'bar',
|
||||
'shortUrlsCount' => 1,
|
||||
'visitsCount' => 2,
|
||||
'visitsSummary' => [
|
||||
'total' => 2,
|
||||
'nonBots' => 1,
|
||||
@@ -123,7 +101,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'foo',
|
||||
'shortUrlsCount' => 2,
|
||||
'visitsCount' => 5,
|
||||
'visitsSummary' => [
|
||||
'total' => 5,
|
||||
'nonBots' => 4,
|
||||
@@ -141,7 +118,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'foo',
|
||||
'shortUrlsCount' => 2,
|
||||
'visitsCount' => 5,
|
||||
'visitsSummary' => [
|
||||
'total' => 5,
|
||||
'nonBots' => 4,
|
||||
@@ -159,7 +135,6 @@ class TagsStatsTest extends ApiTestCase
|
||||
[
|
||||
'tag' => 'foo',
|
||||
'shortUrlsCount' => 1,
|
||||
'visitsCount' => 0,
|
||||
'visitsSummary' => [
|
||||
'total' => 0,
|
||||
'nonBots' => 0,
|
||||
|
||||
@@ -23,7 +23,7 @@ class UpdateTagTest extends ApiTestCase
|
||||
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $resp->getStatusCode());
|
||||
self::assertEquals(self::STATUS_BAD_REQUEST, $payload['status']);
|
||||
self::assertEquals('INVALID_ARGUMENT', $payload['type']);
|
||||
self::assertEquals('https://shlink.io/api/error/invalid-data', $payload['type']);
|
||||
self::assertEquals($expectedDetail, $payload['detail']);
|
||||
self::assertEquals('Invalid data', $payload['title']);
|
||||
}
|
||||
@@ -55,8 +55,8 @@ class UpdateTagTest extends ApiTestCase
|
||||
|
||||
public static function provideTagNotFoundApiVersions(): iterable
|
||||
{
|
||||
yield 'version 1' => ['1', 'TAG_NOT_FOUND'];
|
||||
yield 'version 2' => ['2', 'TAG_NOT_FOUND'];
|
||||
yield 'version 1' => ['1', 'https://shlink.io/api/error/tag-not-found'];
|
||||
yield 'version 2' => ['2', 'https://shlink.io/api/error/tag-not-found'];
|
||||
yield 'version 3' => ['3', 'https://shlink.io/api/error/tag-not-found'];
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ class UpdateTagTest extends ApiTestCase
|
||||
|
||||
public static function provideTagConflictsApiVersions(): iterable
|
||||
{
|
||||
yield 'version 1' => ['1', 'TAG_CONFLICT'];
|
||||
yield 'version 2' => ['2', 'TAG_CONFLICT'];
|
||||
yield 'version 1' => ['1', 'https://shlink.io/api/error/tag-conflict'];
|
||||
yield 'version 2' => ['2', 'https://shlink.io/api/error/tag-conflict'];
|
||||
yield 'version 3' => ['3', 'https://shlink.io/api/error/tag-conflict'];
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ class VisitStatsTest extends ApiTestCase
|
||||
'nonBots' => 2,
|
||||
'bots' => 1,
|
||||
],
|
||||
'visitsCount' => 7,
|
||||
'orphanVisitsCount' => 3,
|
||||
]];
|
||||
yield 'domain-only API key' => ['domain_api_key', [
|
||||
'nonOrphanVisits' => [
|
||||
@@ -46,8 +44,6 @@ class VisitStatsTest extends ApiTestCase
|
||||
'nonBots' => 2,
|
||||
'bots' => 1,
|
||||
],
|
||||
'visitsCount' => 0,
|
||||
'orphanVisitsCount' => 3,
|
||||
]];
|
||||
yield 'author API key' => ['author_api_key', [
|
||||
'nonOrphanVisits' => [
|
||||
@@ -60,8 +56,6 @@ class VisitStatsTest extends ApiTestCase
|
||||
'nonBots' => 2,
|
||||
'bots' => 1,
|
||||
],
|
||||
'visitsCount' => 5,
|
||||
'orphanVisitsCount' => 3,
|
||||
]];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ class AuthenticationTest extends ApiTestCase
|
||||
|
||||
public static function provideApiVersions(): iterable
|
||||
{
|
||||
yield 'version 1' => ['1', 'INVALID_AUTHORIZATION'];
|
||||
yield 'version 2' => ['2', 'INVALID_AUTHORIZATION'];
|
||||
yield 'version 1' => ['1', 'https://shlink.io/api/error/missing-authentication'];
|
||||
yield 'version 2' => ['2', 'https://shlink.io/api/error/missing-authentication'];
|
||||
yield 'version 3' => ['3', 'https://shlink.io/api/error/missing-authentication'];
|
||||
}
|
||||
|
||||
@@ -58,9 +58,9 @@ class AuthenticationTest extends ApiTestCase
|
||||
|
||||
public static function provideInvalidApiKeys(): iterable
|
||||
{
|
||||
yield 'key which does not exist' => ['invalid', '2', 'INVALID_API_KEY'];
|
||||
yield 'key which is expired' => ['expired_api_key', '2', 'INVALID_API_KEY'];
|
||||
yield 'key which is disabled' => ['disabled_api_key', '2', 'INVALID_API_KEY'];
|
||||
yield 'key which does not exist' => ['invalid', '2', 'https://shlink.io/api/error/invalid-api-key'];
|
||||
yield 'key which is expired' => ['expired_api_key', '2', 'https://shlink.io/api/error/invalid-api-key'];
|
||||
yield 'key which is disabled' => ['disabled_api_key', '2', 'https://shlink.io/api/error/invalid-api-key'];
|
||||
yield 'version 3' => ['disabled_api_key', '3', 'https://shlink.io/api/error/invalid-api-key'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user