Add more tests for apiKeyName short URLs filtering

This commit is contained in:
Alejandro Celaya
2025-10-22 08:28:45 +02:00
parent 7860225c25
commit 9c22c7fc9c
3 changed files with 41 additions and 0 deletions

View File

@@ -297,6 +297,24 @@ class ListShortUrlsTest extends ApiTestCase
self::SHORT_URL_DOCS,
]];
// Filter by API key name
yield [['apiKeyName' => 'author_api_key'], [
self::SHORT_URL_CUSTOM_SLUG,
self::SHORT_URL_META,
self::SHORT_URL_SHLINK_WITH_TITLE,
]];
yield [['apiKeyName' => 'invalid'], []];
yield [['apiKeyName' => 'valid_api_key'], [
// If the author_api_key is used, the `apiKeyName` param is ignored
self::SHORT_URL_CUSTOM_SLUG,
self::SHORT_URL_META,
self::SHORT_URL_SHLINK_WITH_TITLE,
], 'author_api_key'];
yield [['apiKeyName' => 'valid_api_key'], [
// If the domain_api_key is used, the `apiKeyName` param is ignored
self::SHORT_URL_CUSTOM_DOMAIN,
], 'domain_api_key'];
// Different API keys
yield [[], [
self::SHORT_URL_CUSTOM_SLUG,