fix normalization for null accompanying period docgen

This commit is contained in:
Julien Fastré 2022-06-16 21:30:46 +02:00
parent dfb583fa8b
commit 0cfad13720
2 changed files with 2 additions and 52 deletions

View File

@ -44,6 +44,7 @@ class AccompanyingPeriodDocGenNormalizer implements ContextAwareNormalizerInterf
private const PERIOD_NULL = [
'id',
'closingDate' => DateTime::class,
'closingMotive' => AccompanyingPeriod\ClosingMotive::class,
'confidential',
'confidentialText',
'createdAt' => DateTime::class,

View File

@ -65,6 +65,7 @@ final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
'type' => 'accompanying_period',
'isNull' => false,
'closingDate' => '@ignored',
'closingMotive' => '@ignored',
'confidential' => true,
'confidentialText' => 'confidentiel',
'createdAt' => '@ignored',
@ -121,59 +122,7 @@ final class AccompanyingPeriodDocGenNormalizerTest extends KernelTestCase
{
$data = $this->normalizer->normalize(null, 'docgen', ['docgen:expects' => AccompanyingPeriod::class]);
$expected = [
'id' => '',
'type' => 'accompanying_period',
'closingDate' => '@ignored',
'confidential' => false,
'confidentialText' => '',
'createdAt' => '@ignored',
'createdBy' => '@ignored',
'emergency' => false,
'emergencyText' => '',
'openingDate' => '@ignored',
'originText' => '',
'origin' => '@ignored',
'requestorAnonymous' => false,
'resources' => [],
'socialIssues' => '@ignored',
'intensity' => '',
'step' => '',
'closingMotiveText' => '',
'socialIssuesText' => '',
'scopes' => '@ignored',
'scopesText' => '',
'ref' => '@ignored',
'participations' => '@ignored',
'currentParticipations' => '@ignored',
'isClosed' => false,
'hasRef' => false,
'hasRequestor' => false,
'requestorKind' => 'none',
'hasRequestorPerson' => false,
'hasRequestorThirdParty' => false,
'requestorPerson' => '@ignored',
'requestorThirdParty' => '@ignored',
'isNull' => true,
'administrativeLocation' => '@ignored',
'hasAdministrativeLocation' => false,
'hasLocation' => false,
'hasLocationPerson' => false,
'location' => '@ignored',
'locationPerson' => '@ignored',
'works' => [],
];
$this->assertIsArray($data);
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($data));
foreach ($expected as $key => $item) {
if ('@ignored' === $item) {
continue;
}
$this->assertEquals($item, $data[$key], "test the key {$key}");
}
}
public function testNormalizeParticipations()