Skip to content

Commit e0e54e0

Browse files
committed
test: ignore deprecations on legacy denormalize tests
#[IgnoreDeprecations] is required alongside expectUserDeprecationMessage() so --fail-on-deprecation does not flag the asserted deprecation in serializer/json-api ItemNormalizer/ItemDenormalizer tests.
1 parent e579a58 commit e0e54e0

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

src/JsonApi/Tests/Serializer/ItemDenormalizerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use ApiPlatform\Metadata\Property\Factory\PropertyNameCollectionFactoryInterface;
2222
use ApiPlatform\Metadata\ResourceClassResolverInterface;
2323
use PHPUnit\Framework\Attributes\Group;
24+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
2425
use PHPUnit\Framework\TestCase;
2526
use Prophecy\PhpUnit\ProphecyTrait;
2627
use Symfony\Component\Serializer\Exception\NotNormalizableValueException;
@@ -53,6 +54,7 @@ public function testSupportsDenormalizationOnlyForJsonApiFormat(): void
5354
}
5455

5556
#[Group('legacy')]
57+
#[IgnoreDeprecations]
5658
public function testDenormalizeOnLegacyItemNormalizerIsDeprecated(): void
5759
{
5860
$this->expectUserDeprecationMessage('Since api-platform/core 4.4: Calling "denormalize()" on "ApiPlatform\JsonApi\Serializer\ItemNormalizer" is deprecated, use "ApiPlatform\JsonApi\Serializer\ItemDenormalizer" instead.');

src/Serializer/Tests/ItemNormalizerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use ApiPlatform\Serializer\ItemNormalizer;
2323
use ApiPlatform\Serializer\Tests\Fixtures\ApiResource\Dummy;
2424
use PHPUnit\Framework\Attributes\Group;
25+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
2526
use PHPUnit\Framework\TestCase;
2627
use Prophecy\Argument;
2728
use Prophecy\PhpUnit\ProphecyTrait;
@@ -146,6 +147,7 @@ public function testNormalizeWithDefinedIri(): void
146147
}
147148

148149
#[Group('legacy')]
150+
#[IgnoreDeprecations]
149151
public function testDenormalizeIsDeprecated(): void
150152
{
151153
$this->expectUserDeprecationMessage('Since api-platform/core 4.4: Calling "denormalize()" on "ApiPlatform\Serializer\ItemNormalizer" is deprecated, use "ApiPlatform\Serializer\ItemDenormalizer" instead.');

0 commit comments

Comments
 (0)