[person]: add new test for social action normalizer

This commit is contained in:
nobohan 2022-10-06 15:26:44 +02:00
parent fb7c6f0a9b
commit 713b8357cd

View File

@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Tests\Serializer\Normalizer;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
/**
* @internal
* @coversNothing
*/
final class SocialActionNormalizerTest extends KernelTestCase
{
private NormalizerInterface $normalizer;
protected function setUp(): void
{
self::bootKernel();
$this->normalizer = self::$container->get(NormalizerInterface::class);
}
public function testNormalization()
{
$sa = new SocialAction();
$normalized = $this->normalizer->normalize(
$sa,
'json',
['groups' => ['read']]
);
$this->assertIsArray($normalized);
$this->assertArrayHasKey('type', $normalized);
$this->assertEquals('social_work_social_action', $normalized['type']);
}
}