Skip to content

Commit 8553702

Browse files
committed
refactor: use imported Group instead of FQCN
1 parent f30ea3c commit 8553702

11 files changed

Lines changed: 30 additions & 19 deletions

File tree

src/Hal/Tests/Serializer/CollectionNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use ApiPlatform\Metadata\ResourceClassResolverInterface;
2323
use ApiPlatform\State\Pagination\PaginatorInterface;
2424
use ApiPlatform\State\Pagination\PartialPaginatorInterface;
25+
use PHPUnit\Framework\Attributes\Group;
2526
use PHPUnit\Framework\TestCase;
2627
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
2728

@@ -30,7 +31,7 @@
3031
*/
3132
class CollectionNormalizerTest extends TestCase
3233
{
33-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
34+
#[Group('legacy')]
3435
public function testSupportsNormalize(): void
3536
{
3637
$resourceClassResolverMock = $this->createMock(ResourceClassResolverInterface::class);

src/Hal/Tests/Serializer/ItemNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
use Symfony\Component\Serializer\Serializer;
4242
use Symfony\Component\Serializer\SerializerInterface;
4343
use Symfony\Component\TypeInfo\Type;
44+
use PHPUnit\Framework\Attributes\Group;
4445

4546
/**
4647
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -73,7 +74,7 @@ public function testDoesNotSupportDenormalization(): void
7374
$normalizer->denormalize(['foo'], 'Foo');
7475
}
7576

76-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
77+
#[Group('legacy')]
7778
public function testSupportsNormalization(): void
7879
{
7980
$std = new \stdClass();

src/Hal/Tests/Serializer/ObjectNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\Hal\Serializer\ObjectNormalizer;
1717
use ApiPlatform\Hal\Tests\Fixtures\Dummy;
1818
use ApiPlatform\Metadata\IriConverterInterface;
19+
use PHPUnit\Framework\Attributes\Group;
1920
use PHPUnit\Framework\TestCase;
2021
use Symfony\Component\Serializer\Exception\LogicException;
2122
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
@@ -42,7 +43,7 @@ public function testDoesNotSupportDenormalization(): void
4243
$normalizer->denormalize(['foo'], 'Foo');
4344
}
4445

45-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
46+
#[Group('legacy')]
4647
public function testSupportsNormalization(): void
4748
{
4849
$std = new \stdClass();

src/Serializer/Tests/AbstractItemNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
5757
use Symfony\Component\Serializer\SerializerInterface;
5858
use Symfony\Component\TypeInfo\Type;
59+
use PHPUnit\Framework\Attributes\Group;
5960

6061
/**
6162
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
@@ -65,7 +66,7 @@ class AbstractItemNormalizerTest extends TestCase
6566
{
6667
use ProphecyTrait;
6768

68-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
69+
#[Group('legacy')]
6970
public function testSupportNormalizationAndSupportDenormalization(): void
7071
{
7172
$std = new \stdClass();

tests/Functional/BackedEnumPropertyTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use ApiPlatform\Tests\RecreateSchemaTrait;
2323
use ApiPlatform\Tests\SetupClassResourcesTrait;
2424
use Symfony\Component\HttpClient\HttpOptions;
25+
use PHPUnit\Framework\Attributes\Group;
2526

2627
final class BackedEnumPropertyTest extends ApiTestCase
2728
{
@@ -53,7 +54,7 @@ public function testJson(): void
5354
]);
5455
}
5556

56-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
57+
#[Group('legacy')]
5758
public function testGraphQl(): void
5859
{
5960
$person = $this->createPerson();

tests/Functional/BackedEnumResourceTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue6264\AvailabilityStatus;
2424
use ApiPlatform\Tests\SetupClassResourcesTrait;
2525
use Symfony\Component\HttpClient\HttpOptions;
26+
use PHPUnit\Framework\Attributes\Group;
2627

2728
final class BackedEnumResourceTest extends ApiTestCase
2829
{
@@ -512,7 +513,7 @@ public static function providerEnumItemsGraphQl(): iterable
512513
}
513514

514515
#[\PHPUnit\Framework\Attributes\DataProvider('providerEnumItemsGraphQl')]
515-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
516+
#[Group('legacy')]
516517
public function testItemGraphql(string $query, array $variables, array $expected): void
517518
{
518519
$options = (new HttpOptions())
@@ -524,7 +525,7 @@ public function testItemGraphql(string $query, array $variables, array $expected
524525
$this->assertJsonEquals($expected);
525526
}
526527

527-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
528+
#[Group('legacy')]
528529
public function testCollectionGraphQl(): void
529530
{
530531
$query = <<<'GRAPHQL'
@@ -551,7 +552,7 @@ public function testCollectionGraphQl(): void
551552
]);
552553
}
553554

554-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
555+
#[Group('legacy')]
555556
public function testItemGraphQlInteger(): void
556557
{
557558
$query = <<<'GRAPHQL'

tests/Functional/Parameters/ParameterTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\WithParameter;
1919
use ApiPlatform\Tests\SetupClassResourcesTrait;
2020
use PHPUnit\Framework\Attributes\DataProvider;
21+
use PHPUnit\Framework\Attributes\Group;
2122

2223
final class ParameterTest extends ApiTestCase
2324
{
@@ -82,7 +83,7 @@ public function testDisabled(): void
8283
* Because of the openapiContext deprecation.
8384
* TODO: only select a few classes to generate the docs for a faster test.
8485
*/
85-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
86+
#[Group('legacy')]
8687
public function testDisableOpenApi(): void
8788
{
8889
$response = self::createClient()->request('GET', 'docs', ['headers' => ['accept' => 'application/vnd.openapi+json']]);

tests/OpenApi/Command/OpenApiCommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Symfony\Component\Console\Tester\ApplicationTester;
2525
use Symfony\Component\Yaml\Exception\ParseException;
2626
use Symfony\Component\Yaml\Yaml;
27+
use PHPUnit\Framework\Attributes\Group;
2728

2829
/**
2930
* @author Amrouche Hamza <hamza.simperfit@gmail.com>
@@ -64,7 +65,7 @@ public function testExecute(): void
6465
$this->assertJson($this->tester->getDisplay());
6566
}
6667

67-
#[\PHPUnit\Framework\Attributes\Group('orm')]
68+
#[Group('orm')]
6869
public function testExecuteWithYaml(): void
6970
{
7071
$this->tester->run(['command' => 'api:openapi:export', '--yaml' => true]);

tests/Problem/Serializer/ConstraintViolationNormalizerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Validator\ConstraintViolation;
2323
use Symfony\Component\Validator\ConstraintViolationList;
2424
use Symfony\Component\Validator\ConstraintViolationListInterface;
25+
use PHPUnit\Framework\Attributes\Group;
2526

2627
/**
2728
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -30,7 +31,7 @@ class ConstraintViolationNormalizerTest extends TestCase
3031
{
3132
use ProphecyTrait;
3233

33-
#[\PHPUnit\Framework\Attributes\Group('legacy')]
34+
#[Group('legacy')]
3435
public function testSupportNormalization(): void
3536
{
3637
$nameConverterProphecy = $this->prophesize(NameConverterInterface::class);

tests/Symfony/Bundle/Test/ApiTestCaseTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Doctrine\ORM\EntityManagerInterface;
3636
use PHPUnit\Framework\ExpectationFailedException;
3737
use Symfony\Component\HttpKernel\KernelInterface;
38+
use PHPUnit\Framework\Attributes\Group;
3839

3940
class ApiTestCaseTest extends ApiTestCase
4041
{
@@ -161,7 +162,7 @@ public function testAssertMatchesResourceCollectionJsonSchema(string $format, st
161162
}
162163

163164
#[\PHPUnit\Framework\Attributes\DataProvider('providerFormats')]
164-
#[\PHPUnit\Framework\Attributes\Group('orm')]
165+
#[Group('orm')]
165166
public function testAssertMatchesResourceCollectionJsonSchemaKeepSerializationContext(string $format, string $mimeType): void
166167
{
167168
$this->recreateSchema([Issue6146Parent::class, Issue6146Child::class]);
@@ -202,7 +203,7 @@ public function testAssertMatchesResourceItemJsonSchemaWithCustomOutput(string $
202203
}
203204

204205
#[\PHPUnit\Framework\Attributes\DataProvider('providerFormats')]
205-
#[\PHPUnit\Framework\Attributes\Group('orm')]
206+
#[Group('orm')]
206207
public function testAssertMatchesResourceItemJsonSchemaWithCustomJson(string $format, string $mimeType): void
207208
{
208209
$this->recreateSchema([JsonSchemaContextDummy::class]);
@@ -218,7 +219,7 @@ public function testAssertMatchesResourceItemJsonSchemaWithCustomJson(string $fo
218219
}
219220

220221
#[\PHPUnit\Framework\Attributes\DataProvider('providerFormats')]
221-
#[\PHPUnit\Framework\Attributes\Group('orm')]
222+
#[Group('orm')]
222223
public function testAssertMatchesResourceItemJsonSchemaOutput(string $format, string $mimeType): void
223224
{
224225
$this->recreateSchema([DummyDtoInputOutput::class]);
@@ -235,7 +236,7 @@ public function testAssertMatchesResourceItemJsonSchemaOutput(string $format, st
235236
}
236237

237238
#[\PHPUnit\Framework\Attributes\DataProvider('providerFormats')]
238-
#[\PHPUnit\Framework\Attributes\Group('orm')]
239+
#[Group('orm')]
239240
public function testAssertMatchesResourceItemAndCollectionJsonSchemaOutputWithContext(string $format, string $mimeType): void
240241
{
241242
$this->recreateSchema([User::class]);
@@ -256,7 +257,7 @@ public function testAssertMatchesResourceItemAndCollectionJsonSchemaOutputWithCo
256257
$this->assertMatchesResourceCollectionJsonSchema(User::class, null, $format, ['groups' => ['api-test-case-group']]);
257258
}
258259

259-
#[\PHPUnit\Framework\Attributes\Group('orm')]
260+
#[Group('orm')]
260261
public function testAssertMatchesResourceItemAndCollectionJsonSchemaOutputWithRangeAssertions(): void
261262
{
262263
$this->recreateSchema([NumericValidated::class]);
@@ -297,7 +298,7 @@ public function testAssertArraySubsetDoesNothingForValidScenario(): void
297298
$this->assertArraySubset([1, 2], [1, 2, 3]);
298299
}
299300

300-
#[\PHPUnit\Framework\Attributes\Group('orm')]
301+
#[Group('orm')]
301302
public function testFindIriBy(): void
302303
{
303304
$this->recreateSchema([Dummy::class, RelatedOwnedDummy::class, RelatedDummy::class]);
@@ -325,7 +326,7 @@ public function testGetPrioritizedOperation(): void
325326
$this->assertResponseIsSuccessful();
326327
}
327328

328-
#[\PHPUnit\Framework\Attributes\Group('mercure')]
329+
#[Group('mercure')]
329330
public function testGetMercureMessages(): void
330331
{
331332
self::bootKernel(['environment' => 'mercure']);

0 commit comments

Comments
 (0)