Rewrote PartNormalizer so that it does not use ObjectNormalizer directly

This commit is contained in:
Jan Böhmer 2024-03-03 19:28:44 +01:00
parent e53da5ad06
commit 7a90d3f281
2 changed files with 28 additions and 18 deletions

View file

@ -28,17 +28,24 @@ use App\Entity\PriceInformations\Orderdetail;
use App\Entity\PriceInformations\Pricedetail;
use App\Serializer\PartNormalizer;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class PartNormalizerTest extends WebTestCase
{
/** @var PartNormalizer */
protected $service;
protected DenormalizerInterface&NormalizerInterface $service;
protected function setUp(): void
{
//Get a service instance.
self::bootKernel();
$this->service = self::getContainer()->get(PartNormalizer::class);
//We need to inject the serializer into the normalizer, as we use it directly
$serializer = self::getContainer()->get('serializer');
$this->service->setNormalizer($serializer);
$this->service->setDenormalizer($serializer);
}
public function testSupportsNormalization(): void