mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
[person]: add origin and social issue normalizer tests + typo
This commit is contained in:
parent
713b8357cd
commit
4ca5fb9869
@ -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\AccompanyingPeriod\Origin;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class AccompanyingPeriodOriginNormalizerTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private NormalizerInterface $normalizer;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNormalization()
|
||||||
|
{
|
||||||
|
$o = new Origin();
|
||||||
|
|
||||||
|
$normalized = $this->normalizer->normalize(
|
||||||
|
$o,
|
||||||
|
'json',
|
||||||
|
['groups' => ['read']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertIsArray($normalized);
|
||||||
|
$this->assertArrayHasKey('type', $normalized);
|
||||||
|
$this->assertEquals('origin', $normalized['type']);
|
||||||
|
}
|
||||||
|
}
|
@ -61,7 +61,7 @@ final class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormlalize()
|
public function testNormalize()
|
||||||
{
|
{
|
||||||
$work = new AccompanyingPeriodWork();
|
$work = new AccompanyingPeriodWork();
|
||||||
$work
|
$work
|
||||||
|
@ -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\SocialIssue;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class SocialIssueNormalizerTest extends KernelTestCase
|
||||||
|
{
|
||||||
|
private NormalizerInterface $normalizer;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
self::bootKernel();
|
||||||
|
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNormalization()
|
||||||
|
{
|
||||||
|
$si = new SocialIssue();
|
||||||
|
|
||||||
|
$normalized = $this->normalizer->normalize(
|
||||||
|
$si,
|
||||||
|
'json',
|
||||||
|
['groups' => ['read']]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertIsArray($normalized);
|
||||||
|
$this->assertArrayHasKey('type', $normalized);
|
||||||
|
$this->assertEquals('social_issue', $normalized['type']);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user