mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
AccompanyingPeriodResource: fix deserialization + code style
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Serializer\Normalizer;
|
||||
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ResourceJsonNormalizerTest extends KernelTestCase
|
||||
{
|
||||
private DenormalizerInterface $denormalizer;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
self::bootKernel();
|
||||
$this->denormalizer = self::$container->get(DenormalizerInterface::class);
|
||||
}
|
||||
|
||||
public function testDenormalize()
|
||||
{
|
||||
$resource = new Resource();
|
||||
|
||||
$context = [
|
||||
AbstractNormalizer::GROUPS => ['write'],
|
||||
AbstractNormalizer::OBJECT_TO_POPULATE => $resource,
|
||||
];
|
||||
|
||||
$json = [
|
||||
'comment' => 'bloup',
|
||||
'type' => 'accompanying_period_resource',
|
||||
];
|
||||
|
||||
$resource = $this->denormalizer->denormalize($json, Resource::class, 'json', $context);
|
||||
|
||||
$this->assertEquals('bloup', $resource->getComment());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user