fix(state): avoid deprecated PartialDenormalizationException::getErrors()
This commit is contained in:
1 parent
b2a14e558d
commit
1da883f931
5 files changed
+46
-21
No files matched your search
@@ -17,8 +17,6 @@ use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
|
||||
use ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\EnumValidationResource;
|
||||
use ApiPlatform\Tests\SetupClassResourcesTrait;
|
||||
use Composer\InstalledVersions;
|
||||
use Composer\Semver\VersionParser;
|
||||
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
|
||||
|
||||
/**
|
||||
* @see https://github.com/api-platform/core/issues/8183
|
||||
@@ -67,13 +65,8 @@ final class EnumDenormalizationValidationTest extends ApiTestCase
|
||||
$this->assertNotNull($genderViolation, 'Expected a constraint violation on "gender" property.');
|
||||
}
|
||||
|
||||
#[IgnoreDeprecations]
|
||||
public function testInvalidBackedEnumValueWithCollectDenormalizationErrors(): void
|
||||
{
|
||||
if (InstalledVersions::satisfies(new VersionParser(), 'symfony/serializer', '>=8.1')) {
|
||||
$this->expectUserDeprecationMessage('Since symfony/serializer 8.1: The "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getErrors()" method is deprecated, use "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getNotNormalizableValueErrors()" instead.');
|
||||
}
|
||||
|
||||
$response = static::createClient()->request('POST', '/enum_validation_resources_collect', [
|
||||
'headers' => ['Content-Type' => 'application/ld+json'],
|
||||
'json' => ['gender' => 'unknown'],
|
||||
@@ -87,13 +80,8 @@ final class EnumDenormalizationValidationTest extends ApiTestCase
|
||||
/**
|
||||
* @see https://github.com/api-platform/core/issues/8388
|
||||
*/
|
||||
#[IgnoreDeprecations]
|
||||
public function testWrongTypeForBackedEnumReportsAcceptedScalarTypes(): void
|
||||
{
|
||||
if (InstalledVersions::satisfies(new VersionParser(), 'symfony/serializer', '>=8.1')) {
|
||||
$this->expectUserDeprecationMessage('Since symfony/serializer 8.1: The "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getErrors()" method is deprecated, use "Symfony\Component\Serializer\Exception\PartialDenormalizationException::getNotNormalizableValueErrors()" instead.');
|
||||
}
|
||||
|
||||
$response = static::createClient()->request('POST', '/enum_validation_resources_collect', [
|
||||
'headers' => ['Content-Type' => 'application/ld+json'],
|
||||
'json' => ['gender' => true],
|
||||
|
||||
Reference in new issue
Block a user