mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-03-03 12:39:42 +00:00
Refactor GenderDocGenNormalizer: rename to GenderNormalizer, update getSupportedTypes logic, and adjust related tests.
This commit is contained in:
@@ -17,7 +17,7 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class GenderDocGenNormalizer implements NormalizerInterface, NormalizerAwareInterface
|
||||
class GenderNormalizer implements NormalizerInterface, NormalizerAwareInterface
|
||||
{
|
||||
use NormalizerAwareTrait;
|
||||
|
||||
@@ -40,8 +40,13 @@ class GenderDocGenNormalizer implements NormalizerInterface, NormalizerAwareInte
|
||||
|
||||
public function getSupportedTypes(?string $format): array
|
||||
{
|
||||
return [
|
||||
Gender::class => true,
|
||||
];
|
||||
return match ($format) {
|
||||
'json' => [Gender::class => true],
|
||||
'docgen' => [
|
||||
Gender::class => true,
|
||||
'*' => false,
|
||||
],
|
||||
default => [],
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace Serializer\Normalizer;
|
||||
|
||||
use Chill\MainBundle\Entity\Gender;
|
||||
use Chill\MainBundle\Entity\GenderEnum;
|
||||
use Chill\MainBundle\Serializer\Normalizer\GenderDocGenNormalizer;
|
||||
use Chill\MainBundle\Serializer\Normalizer\GenderNormalizer;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -24,13 +24,13 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
final class GenderDocGenNormalizerTest extends TestCase
|
||||
{
|
||||
private GenderDocGenNormalizer $normalizer;
|
||||
private GenderNormalizer $normalizer;
|
||||
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->translatableStringHelper = $this->createMock(TranslatableStringHelperInterface::class);
|
||||
$this->normalizer = new GenderDocGenNormalizer($this->translatableStringHelper);
|
||||
$this->normalizer = new GenderNormalizer($this->translatableStringHelper);
|
||||
}
|
||||
|
||||
public function testSupportsNormalizationReturnsTrueForGenderInstance(): void
|
||||
|
||||
Reference in New Issue
Block a user