Record that a ticket can be in emergency, or not

This commit is contained in:
2025-06-24 10:42:51 +00:00
parent d43b739654
commit 0a331aab37
22 changed files with 896 additions and 5 deletions

View File

@@ -16,6 +16,8 @@ use Chill\MainBundle\Entity\UserGroup;
use Chill\PersonBundle\Entity\Person;
use Chill\TicketBundle\Entity\AddresseeHistory;
use Chill\TicketBundle\Entity\Comment;
use Chill\TicketBundle\Entity\EmergencyStatusEnum;
use Chill\TicketBundle\Entity\EmergencyStatusHistory;
use Chill\TicketBundle\Entity\Motive;
use Chill\TicketBundle\Entity\MotiveHistory;
use Chill\TicketBundle\Entity\PersonHistory;
@@ -109,6 +111,7 @@ class TicketNormalizerTest extends KernelTestCase
'currentState' => 'open',
'updatedAt' => $t->getUpdatedAt()->getTimestamp(),
'updatedBy' => ['user'],
'emergency' => 'no',
],
];
@@ -117,6 +120,7 @@ class TicketNormalizerTest extends KernelTestCase
// added by action
new StateHistory(StateEnum::OPEN, $ticket, new \DateTimeImmutable('2024-06-16T00:00:00Z'));
new EmergencyStatusHistory(EmergencyStatusEnum::YES, $ticket, new \DateTimeImmutable('2024-06-16T00:00:10Z'));
// those are added by doctrine listeners
$ticket->setCreatedAt(new \DateTimeImmutable('2024-06-16T00:00:00Z'));
@@ -155,10 +159,12 @@ class TicketNormalizerTest extends KernelTestCase
['event_type' => 'addressees_state'],
['event_type' => 'create_ticket'],
['event_type' => 'state_change'],
['event_type' => 'emergency_change'],
],
'currentState' => 'open',
'updatedAt' => $ticket->getUpdatedAt()->getTimestamp(),
'updatedBy' => ['user'],
'emergency' => 'yes',
],
];
}
@@ -213,6 +219,11 @@ class TicketNormalizerTest extends KernelTestCase
'json',
['groups' => 'read']
)->will(fn ($args): array => $args[0]);
$normalizer->normalize(
Argument::that(fn ($arg) => is_array($arg) && 1 === count($arg) && array_key_exists('new_emergency', $arg)),
'json',
['groups' => 'read']
)->will(fn ($args): array => $args[0]);
// datetime
$normalizer->normalize(Argument::type(\DateTimeImmutable::class), 'json', Argument::type('array'))