mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-09 16:53:11 +08:00
Replace traits with external data providers in API tests
This commit is contained in:
@@ -9,16 +9,16 @@ use GuzzleHttp\Psr7\Query;
|
||||
use GuzzleHttp\RequestOptions;
|
||||
use Laminas\Diactoros\Uri;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\DataProviderExternal;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
|
||||
use ShlinkioApiTest\Shlink\Rest\Utils\NotFoundUrlHelpersTrait;
|
||||
use ShlinkioApiTest\Shlink\Rest\Utils\ApiTestDataProviders;
|
||||
use ShlinkioApiTest\Shlink\Rest\Utils\UrlBuilder;
|
||||
|
||||
use function sprintf;
|
||||
|
||||
class EditShortUrlTest extends ApiTestCase
|
||||
{
|
||||
use NotFoundUrlHelpersTrait;
|
||||
|
||||
#[Test, DataProvider('provideMeta')]
|
||||
public function metadataCanBeReset(array $meta): void
|
||||
{
|
||||
@@ -99,14 +99,14 @@ class EditShortUrlTest extends ApiTestCase
|
||||
yield 'invalid URL' => ['http://foo', self::STATUS_BAD_REQUEST, 'INVALID_URL'];
|
||||
}
|
||||
|
||||
#[Test, DataProvider('provideInvalidUrls')]
|
||||
#[Test, DataProviderExternal(ApiTestDataProviders::class, 'invalidUrlsProvider')]
|
||||
public function tryingToEditInvalidUrlReturnsNotFoundError(
|
||||
string $shortCode,
|
||||
?string $domain,
|
||||
string $expectedDetail,
|
||||
string $apiKey,
|
||||
): void {
|
||||
$url = $this->buildShortUrlPath($shortCode, $domain);
|
||||
$url = UrlBuilder::buildShortUrlPath($shortCode, $domain);
|
||||
$resp = $this->callApiWithKey(self::METHOD_PATCH, $url, [RequestOptions::JSON => []], $apiKey);
|
||||
$payload = $this->getJsonResponsePayload($resp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user