Migrate from PHPUnit annotations to native attributes

This commit is contained in:
Alejandro Celaya
2023-02-09 20:42:18 +01:00
parent 650a286982
commit 04bbd471ff
188 changed files with 776 additions and 1082 deletions

View File

@@ -4,6 +4,8 @@ declare(strict_types=1);
namespace ShlinkioApiTest\Shlink\Rest\Action;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use Shlinkio\Shlink\TestUtils\ApiTest\ApiTestCase;
use ShlinkioApiTest\Shlink\Rest\Utils\NotFoundUrlHelpersTrait;
@@ -13,10 +15,7 @@ class DeleteShortUrlTest extends ApiTestCase
{
use NotFoundUrlHelpersTrait;
/**
* @test
* @dataProvider provideInvalidUrls
*/
#[Test, DataProvider('provideInvalidUrls')]
public function notFoundErrorIsReturnWhenDeletingInvalidUrl(
string $shortCode,
?string $domain,
@@ -35,10 +34,7 @@ class DeleteShortUrlTest extends ApiTestCase
self::assertEquals($domain, $payload['domain'] ?? null);
}
/**
* @test
* @dataProvider provideApiVersions
*/
#[Test, DataProvider('provideApiVersions')]
public function expectedTypeIsReturnedBasedOnApiVersion(string $version, string $expectedType): void
{
$resp = $this->callApiWithKey(
@@ -57,7 +53,7 @@ class DeleteShortUrlTest extends ApiTestCase
yield ['3', 'https://shlink.io/api/error/short-url-not-found'];
}
/** @test */
#[Test]
public function properShortUrlIsDeletedWhenDomainIsProvided(): void
{
$fetchWithDomainBefore = $this->callApiWithKey(self::METHOD_GET, '/short-urls/ghi789?domain=example.com');