mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
full generation for accompanying period
This commit is contained in:
@@ -1,15 +1,27 @@
|
||||
<?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\MainBundle\Entity\Scope;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Entity\SocialWork\SocialIssue;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||
|
||||
class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
{
|
||||
private NormalizerInterface $normalizer;
|
||||
|
||||
@@ -27,7 +39,7 @@ class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
$period->setOrigin((new AccompanyingPeriod\Origin())->setLabel(['fr' => 'origin']));
|
||||
$period->setClosingMotive((new AccompanyingPeriod\ClosingMotive())->setName(['closing']));
|
||||
$period->addScope((new Scope())->setName(['fr' => 'scope1']));
|
||||
$period->addScope((new Scope())->setName(['fr' =>'scope2']));
|
||||
$period->addScope((new Scope())->setName(['fr' => 'scope2']));
|
||||
$period->addSocialIssue((new SocialIssue())->setTitle(['fr' => 'issue1']));
|
||||
$period->addSocialIssue((new SocialIssue())->setTitle(['fr' => 'issue2']));
|
||||
$data = $this->normalizer->normalize($period, 'docgen', ['docgen:expects' => AccompanyingPeriod::class]);
|
||||
@@ -59,7 +71,7 @@ class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($data));
|
||||
|
||||
foreach ($expected as $key => $item) {
|
||||
if ($item === '@ignored') {
|
||||
if ('@ignored' === $item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -72,13 +84,13 @@ class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
$data = $this->normalizer->normalize(null, 'docgen', ['docgen:expects' => AccompanyingPeriod::class]);
|
||||
|
||||
$expected = [
|
||||
'id' => "",
|
||||
'id' => '',
|
||||
'closingDate' => '@ignored',
|
||||
'confidential' => "",
|
||||
'confidential' => '',
|
||||
'confidentialText' => '',
|
||||
'createdAt' => '@ignored',
|
||||
'createdBy' => '@ignored',
|
||||
'emergency' => "",
|
||||
'emergency' => '',
|
||||
'emergencyText' => '',
|
||||
'openingDate' => '@ignored',
|
||||
'originText' => '',
|
||||
@@ -98,12 +110,11 @@ class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
|
||||
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($data));
|
||||
|
||||
foreach ($expected as $key => $item) {
|
||||
if ($item === '@ignored') {
|
||||
if ('@ignored' === $item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->assertEquals($item, $data[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user