mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add basic context for AccompanyingPeriodWorkEvalution WIP
This commit is contained in:
parent
e053529afb
commit
23eff9f6d4
@ -13,7 +13,7 @@ namespace Chill\DocGeneratorBundle\Context;
|
|||||||
|
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
interface DocGeneratorContextWithAdminFormInterface
|
interface DocGeneratorContextWithAdminFormInterface extends DocGeneratorContextInterface
|
||||||
{
|
{
|
||||||
public function adminFormReverseTransform(array $data): array;
|
public function adminFormReverseTransform(array $data): array;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ namespace Chill\DocGeneratorBundle\Context;
|
|||||||
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
interface DocGeneratorContextWithPublicFormInterface
|
interface DocGeneratorContextWithPublicFormInterface extends DocGeneratorContextInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Generate the form that display.
|
* Generate the form that display.
|
||||||
|
@ -18,6 +18,7 @@ use Chill\DocStoreBundle\Form\StoredObjectType;
|
|||||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\CallbackTransformer;
|
use Symfony\Component\Form\CallbackTransformer;
|
||||||
|
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
|
|
||||||
@ -43,6 +44,14 @@ class DocGeneratorTemplateType extends AbstractType
|
|||||||
->add('description')
|
->add('description')
|
||||||
->add('file', StoredObjectType::class, [
|
->add('file', StoredObjectType::class, [
|
||||||
'error_bubbling' => true,
|
'error_bubbling' => true,
|
||||||
|
])
|
||||||
|
->add('active', ChoiceType::class, [
|
||||||
|
'label' => 'Active',
|
||||||
|
'choices' => [
|
||||||
|
'Yes' => true,
|
||||||
|
'No' => false,
|
||||||
|
],
|
||||||
|
'required' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($context instanceof DocGeneratorContextWithAdminFormInterface
|
if ($context instanceof DocGeneratorContextWithAdminFormInterface
|
||||||
|
@ -64,26 +64,36 @@ class AccompanyingPeriodContext implements
|
|||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
public function adminFormReverseTransform(array $data): array
|
||||||
{
|
{
|
||||||
return [
|
$data = [
|
||||||
'mainPerson' => $data['mainPerson'],
|
'mainPerson' => $data['mainPerson'],
|
||||||
'person1' => $data['person1'],
|
'person1' => $data['person1'],
|
||||||
'person2' => $data['person2'],
|
'person2' => $data['person2'],
|
||||||
'category' => [
|
];
|
||||||
|
|
||||||
|
if (array_key_exists('category', $data)) {
|
||||||
|
$data['category'] = [
|
||||||
'idInsideBundle' => $data['category']->getIdInsideBundle(),
|
'idInsideBundle' => $data['category']->getIdInsideBundle(),
|
||||||
'bundleId' => $data['category']->getBundleId(),
|
'bundleId' => $data['category']->getBundleId(),
|
||||||
],
|
];
|
||||||
];
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function adminFormTransform(array $data): array
|
public function adminFormTransform(array $data): array
|
||||||
{
|
{
|
||||||
return [
|
$data = [
|
||||||
'mainPerson' => $data['mainPerson'] ?? false,
|
'mainPerson' => $data['mainPerson'] ?? false,
|
||||||
'person1' => $data['person1'] ?? false,
|
'person1' => $data['person1'] ?? false,
|
||||||
'person2' => $data['person2'] ?? false,
|
'person2' => $data['person2'] ?? false,
|
||||||
'category' => array_key_exists('category', $data) ?
|
|
||||||
$this->documentCategoryRepository->find($data['category']) : null,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (array_key_exists('category', $data)) {
|
||||||
|
$data['category'] = array_key_exists('category', $data) ?
|
||||||
|
$this->documentCategoryRepository->find($data['category']) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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 Chill\PersonBundle\Service\DocGenerator;
|
namespace Chill\PersonBundle\Service\DocGenerator;
|
||||||
|
|
||||||
use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
|
use Chill\DocGeneratorBundle\Context\DocGeneratorContextInterface;
|
||||||
@ -17,10 +26,10 @@ class AccompanyingPeriodWorkContext implements
|
|||||||
DocGeneratorContextWithAdminFormInterface,
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
DocGeneratorContextWithPublicFormInterface
|
DocGeneratorContextWithPublicFormInterface
|
||||||
{
|
{
|
||||||
private AccompanyingPeriodContext $periodContext;
|
|
||||||
|
|
||||||
private NormalizerInterface $normalizer;
|
private NormalizerInterface $normalizer;
|
||||||
|
|
||||||
|
private AccompanyingPeriodContext $periodContext;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
AccompanyingPeriodContext $periodContext,
|
AccompanyingPeriodContext $periodContext,
|
||||||
NormalizerInterface $normalizer
|
NormalizerInterface $normalizer
|
||||||
@ -29,6 +38,26 @@ class AccompanyingPeriodWorkContext implements
|
|||||||
$this->normalizer = $normalizer;
|
$this->normalizer = $normalizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
{
|
||||||
|
return $this->periodContext->adminFormReverseTransform($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function adminFormTransform(array $data): array
|
||||||
|
{
|
||||||
|
return $this->periodContext->adminFormTransform($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
$this->periodContext->buildAdminForm($builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
||||||
|
{
|
||||||
|
$this->periodContext->buildPublicForm($builder, $template, $entity);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param AccompanyingPeriodWork $entity
|
* @param AccompanyingPeriodWork $entity
|
||||||
*/
|
*/
|
||||||
@ -45,7 +74,7 @@ class AccompanyingPeriodWorkContext implements
|
|||||||
|
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
return "A context for work";
|
return 'A context for work';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEntityClass(): string
|
public function getEntityClass(): string
|
||||||
@ -60,27 +89,7 @@ class AccompanyingPeriodWorkContext implements
|
|||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return "Accompanying period work";
|
return 'Accompanying period work';
|
||||||
}
|
|
||||||
|
|
||||||
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
|
||||||
{
|
|
||||||
// TODO: Implement storeGenerated() method.
|
|
||||||
}
|
|
||||||
|
|
||||||
public function adminFormReverseTransform(array $data): array
|
|
||||||
{
|
|
||||||
return $this->periodContext->adminFormReverseTransform($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function adminFormTransform(array $data): array
|
|
||||||
{
|
|
||||||
return $this->periodContext->adminFormTransform($data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildAdminForm(FormBuilderInterface $builder): void
|
|
||||||
{
|
|
||||||
$this->periodContext->buildAdminForm($builder);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function hasAdminForm(): bool
|
public function hasAdminForm(): bool
|
||||||
@ -88,13 +97,13 @@ class AccompanyingPeriodWorkContext implements
|
|||||||
return $this->periodContext->hasAdminForm();
|
return $this->periodContext->hasAdminForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
|
||||||
{
|
|
||||||
$this->periodContext->buildPublicForm($builder, $template, $entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
||||||
{
|
{
|
||||||
return $this->periodContext->hasPublicForm($template, $entity);
|
return $this->periodContext->hasPublicForm($template, $entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||||
|
{
|
||||||
|
// TODO: Implement storeGenerated() method.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,143 @@
|
|||||||
|
<?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 Chill\PersonBundle\Service\DocGenerator;
|
||||||
|
|
||||||
|
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithAdminFormInterface;
|
||||||
|
use Chill\DocGeneratorBundle\Context\DocGeneratorContextWithPublicFormInterface;
|
||||||
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
||||||
|
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||||
|
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
|
||||||
|
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluationDocument;
|
||||||
|
use Chill\PersonBundle\Entity\SocialWork\Evaluation;
|
||||||
|
use Chill\PersonBundle\Repository\SocialWork\EvaluationRepository;
|
||||||
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||||
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
|
||||||
|
class AccompanyingPeriodWorkEvaluationContext implements
|
||||||
|
DocGeneratorContextWithAdminFormInterface,
|
||||||
|
DocGeneratorContextWithPublicFormInterface
|
||||||
|
{
|
||||||
|
private AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext;
|
||||||
|
|
||||||
|
private EntityManagerInterface $em;
|
||||||
|
|
||||||
|
private EvaluationRepository $evaluationRepository;
|
||||||
|
|
||||||
|
private TranslatableStringHelperInterface $translatableStringHelper;
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
AccompanyingPeriodWorkContext $accompanyingPeriodWorkContext,
|
||||||
|
EntityManagerInterface $em,
|
||||||
|
EvaluationRepository $evaluationRepository,
|
||||||
|
TranslatableStringHelperInterface $translatableStringHelper
|
||||||
|
) {
|
||||||
|
$this->accompanyingPeriodWorkContext = $accompanyingPeriodWorkContext;
|
||||||
|
$this->em = $em;
|
||||||
|
$this->evaluationRepository = $evaluationRepository;
|
||||||
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function adminFormReverseTransform(array $data): array
|
||||||
|
{
|
||||||
|
return array_merge(
|
||||||
|
$this->accompanyingPeriodWorkContext->adminFormReverseTransform($data),
|
||||||
|
[
|
||||||
|
'evaluations' => array_map(
|
||||||
|
static function (Evaluation $e) { return $e->getId(); },
|
||||||
|
$data['evaluations']
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function adminFormTransform(array $data): array
|
||||||
|
{
|
||||||
|
return array_merge(
|
||||||
|
$this->accompanyingPeriodWorkContext->adminFormTransform($data),
|
||||||
|
[
|
||||||
|
'evaluations' => array_map(
|
||||||
|
function ($id) { return $this->evaluationRepository->find($id); },
|
||||||
|
$data['evaluations'] ?? []
|
||||||
|
),
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildAdminForm(FormBuilderInterface $builder): void
|
||||||
|
{
|
||||||
|
$this->accompanyingPeriodWorkContext->buildAdminForm($builder);
|
||||||
|
|
||||||
|
$builder->remove('category');
|
||||||
|
|
||||||
|
$builder->add('evaluations', EntityType::class, [
|
||||||
|
'class' => Evaluation::class,
|
||||||
|
'label' => 'Linked evaluations',
|
||||||
|
'choices' => $this->evaluationRepository->findAll(),
|
||||||
|
'choice_label' => function (Evaluation $e) {
|
||||||
|
return $this->translatableStringHelper->localize($e->getTitle());
|
||||||
|
},
|
||||||
|
'multiple' => true,
|
||||||
|
'expanded' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildPublicForm(FormBuilderInterface $builder, DocGeneratorTemplate $template, $entity): void
|
||||||
|
{
|
||||||
|
// TODO: Implement buildPublicForm() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getData(DocGeneratorTemplate $template, $entity, array $contextGenerationData = []): array
|
||||||
|
{
|
||||||
|
// TODO: Implement getData() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Context for accompanying period work';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEntityClass(): string
|
||||||
|
{
|
||||||
|
return AccompanyingPeriodWorkEvaluation::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getKey(): string
|
||||||
|
{
|
||||||
|
return 'accompanying_period_work_evaluation_regular';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getName(): string
|
||||||
|
{
|
||||||
|
return 'Accompanying period work context';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasAdminForm(): bool
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function hasPublicForm(DocGeneratorTemplate $template, $entity): bool
|
||||||
|
{
|
||||||
|
// TODO: Implement hasPublicForm() method.
|
||||||
|
}
|
||||||
|
|
||||||
|
public function storeGenerated(DocGeneratorTemplate $template, StoredObject $storedObject, object $entity, array $contextGenerationData): void
|
||||||
|
{
|
||||||
|
$doc = new AccompanyingPeriodWorkEvaluationDocument();
|
||||||
|
$doc->setStoredObject($storedObject)
|
||||||
|
->setAccompanyingPeriodWorkEvaluation($entity)
|
||||||
|
->setTemplate($template);
|
||||||
|
$this->em->persist($doc);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?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;
|
namespace Serializer\Normalizer;
|
||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
@ -8,11 +17,16 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkGoal;
|
|||||||
use Chill\PersonBundle\Entity\Person;
|
use Chill\PersonBundle\Entity\Person;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
use Chill\PersonBundle\Entity\SocialWork\Goal;
|
||||||
use Chill\PersonBundle\Entity\SocialWork\Result;
|
use Chill\PersonBundle\Entity\SocialWork\Result;
|
||||||
|
use DateTimeImmutable;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversNothing
|
||||||
|
*/
|
||||||
|
final class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private NormalizerInterface $normalizer;
|
private NormalizerInterface $normalizer;
|
||||||
|
|
||||||
@ -22,6 +36,31 @@ class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
|||||||
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
$this->normalizer = self::$container->get(NormalizerInterface::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNormalizationNull()
|
||||||
|
{
|
||||||
|
$actual = $this->normalizer->normalize(null, 'docgen', [
|
||||||
|
'docgen:expects' => AccompanyingPeriodWork::class,
|
||||||
|
AbstractNormalizer::GROUPS => ['docgen:read'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
dump($actual);
|
||||||
|
|
||||||
|
$expected = [
|
||||||
|
'id' => '',
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->assertIsArray($actual);
|
||||||
|
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($actual));
|
||||||
|
|
||||||
|
foreach ($expected as $key => $item) {
|
||||||
|
if ('@ignored' === $item) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals($item, $actual[$key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function testNormlalize()
|
public function testNormlalize()
|
||||||
{
|
{
|
||||||
$work = new AccompanyingPeriodWork();
|
$work = new AccompanyingPeriodWork();
|
||||||
@ -29,24 +68,22 @@ class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
|||||||
->addPerson((new Person())->setFirstName('hello')->setLastName('name'))
|
->addPerson((new Person())->setFirstName('hello')->setLastName('name'))
|
||||||
->addGoal($g = new AccompanyingPeriodWorkGoal())
|
->addGoal($g = new AccompanyingPeriodWorkGoal())
|
||||||
->addResult($r = new Result())
|
->addResult($r = new Result())
|
||||||
->setCreatedAt(new \DateTimeImmutable())
|
->setCreatedAt(new DateTimeImmutable())
|
||||||
->setUpdatedAt(new \DateTimeImmutable())
|
->setUpdatedAt(new DateTimeImmutable())
|
||||||
->setCreatedBy($user = new User())
|
->setCreatedBy($user = new User())
|
||||||
->setUpdatedBy($user)
|
->setUpdatedBy($user);
|
||||||
;
|
|
||||||
$g->addResult($r)->setGoal($goal = new Goal());
|
$g->addResult($r)->setGoal($goal = new Goal());
|
||||||
$goal->addResult($r);
|
$goal->addResult($r);
|
||||||
|
|
||||||
$actual = $this->normalizer->normalize($work, 'docgen', [
|
$actual = $this->normalizer->normalize($work, 'docgen', [
|
||||||
'docgen:expects' => AccompanyingPeriodWork::class,
|
'docgen:expects' => AccompanyingPeriodWork::class,
|
||||||
AbstractNormalizer::GROUPS => ['docgen:read']
|
AbstractNormalizer::GROUPS => ['docgen:read'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var_dump($actual);
|
var_dump($actual);
|
||||||
|
|
||||||
$expected = [
|
$expected = [
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->assertIsArray($actual);
|
$this->assertIsArray($actual);
|
||||||
@ -60,33 +97,4 @@ class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase
|
|||||||
$this->assertEquals($item, $actual[$key]);
|
$this->assertEquals($item, $actual[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalizationNull()
|
|
||||||
{
|
|
||||||
$actual = $this->normalizer->normalize(null, 'docgen', [
|
|
||||||
'docgen:expects' => AccompanyingPeriodWork::class,
|
|
||||||
AbstractNormalizer::GROUPS => ['docgen:read']
|
|
||||||
]);
|
|
||||||
|
|
||||||
dump($actual);
|
|
||||||
|
|
||||||
$expected = [
|
|
||||||
'id' => ""
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->assertIsArray($actual);
|
|
||||||
$this->assertEqualsCanonicalizing(array_keys($expected), array_keys($actual));
|
|
||||||
|
|
||||||
foreach ($expected as $key => $item) {
|
|
||||||
if ('@ignored' === $item) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->assertEquals($item, $actual[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user