mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
thirdparty: fix denormalization of thirdparty
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\ThirdPartyBundle\Test\Serializer\Normalizer;
|
||||
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class ThirdPartyJsonDenormalizerTest extends KernelTestCase
|
||||
{
|
||||
private DenormalizerInterface $normalizer;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
self::bootKernel();
|
||||
|
||||
$this->normalizer = self::$container->get(DenormalizerInterface::class);
|
||||
}
|
||||
|
||||
public function testDenormalizeContact()
|
||||
{
|
||||
$str = <<<JSON
|
||||
{
|
||||
"type": "thirdparty",
|
||||
"name": "badaboum",
|
||||
"email": "badaboum@email.com",
|
||||
"telephone": "+32486540660",
|
||||
"kind": "contact"
|
||||
}
|
||||
JSON;
|
||||
|
||||
$actual = $this->normalizer->denormalize(json_decode($str, true), ThirdParty::class, 'json', [
|
||||
'groups' => ['write']
|
||||
]);
|
||||
|
||||
$this->assertInstanceOf(ThirdParty::class, $actual);
|
||||
$this->assertEquals('badaboum', $actual->getName());
|
||||
$this->assertEquals('badaboum@email.com', $actual->getEmail());
|
||||
$this->assertEquals(ThirdParty::KIND_CONTACT, $actual->getKind());
|
||||
}
|
||||
|
||||
}
|
@@ -44,8 +44,6 @@ final class ThirdpartyDocGenNormalizerTest extends KernelTestCase
|
||||
|
||||
$actual = $this->normalizer->normalize($thirdparty, 'docgen', ['groups' => ['docgen:read']]);
|
||||
|
||||
var_dump($actual);
|
||||
|
||||
$this->assertIsArray($actual);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user