mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-11-21 03:17:46 +00:00
Créer un point d'api de suggestion des usagers pour un ticket
This commit is contained in:
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\UserGroup;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\TicketBundle\Entity\AddresseeHistory;
|
||||
use Chill\TicketBundle\Entity\CallerHistory;
|
||||
use Chill\TicketBundle\Entity\Comment;
|
||||
use Chill\TicketBundle\Entity\EmergencyStatusEnum;
|
||||
use Chill\TicketBundle\Entity\EmergencyStatusHistory;
|
||||
@@ -91,27 +92,16 @@ class TicketNormalizerTest extends KernelTestCase
|
||||
'history' => [
|
||||
[
|
||||
'event_type' => 'create_ticket',
|
||||
'at' => 1718495999,
|
||||
'by' => [
|
||||
0 => 'user',
|
||||
],
|
||||
'data' => [],
|
||||
],
|
||||
[
|
||||
'event_type' => 'state_change',
|
||||
'at' => 1718495999,
|
||||
'by' => [
|
||||
0 => 'user',
|
||||
],
|
||||
'data' => [
|
||||
'new_state' => 'open',
|
||||
],
|
||||
],
|
||||
],
|
||||
'currentState' => 'open',
|
||||
'updatedAt' => $t->getUpdatedAt()->getTimestamp(),
|
||||
'updatedBy' => ['user'],
|
||||
'emergency' => 'no',
|
||||
'caller' => null,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -165,6 +155,36 @@ class TicketNormalizerTest extends KernelTestCase
|
||||
'updatedAt' => $ticket->getUpdatedAt()->getTimestamp(),
|
||||
'updatedBy' => ['user'],
|
||||
'emergency' => 'yes',
|
||||
'caller' => null,
|
||||
],
|
||||
];
|
||||
|
||||
// ticket with caller
|
||||
$ticket = new Ticket();
|
||||
$ticket->setCreatedAt(new \DateTimeImmutable('2024-06-16T00:00:00'));
|
||||
$ticket->setUpdatedAt(new \DateTimeImmutable('2024-06-16T00:00:00'));
|
||||
new CallerHistory(new Person(), $ticket, new \DateTimeImmutable('2024-04-01T12:00:00'));
|
||||
|
||||
yield [
|
||||
$ticket,
|
||||
[
|
||||
'type' => 'ticket_ticket',
|
||||
'createdAt' => $ticket->getCreatedAt()?->getTimestamp(),
|
||||
'createdBy' => null,
|
||||
'id' => null,
|
||||
'externalRef' => '',
|
||||
'currentPersons' => [],
|
||||
'currentAddressees' => [],
|
||||
'currentInputs' => [],
|
||||
'currentMotive' => null,
|
||||
'history' => [
|
||||
['event_type' => 'set_caller'],
|
||||
],
|
||||
'currentState' => 'open',
|
||||
'updatedAt' => $ticket->getUpdatedAt()->getTimestamp(),
|
||||
'updatedBy' => null,
|
||||
'emergency' => 'no',
|
||||
'caller' => ['person'],
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -224,6 +244,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_caller', $arg)),
|
||||
'json',
|
||||
['groups' => 'read']
|
||||
)->will(fn ($args): array => ['new_caller' => ['dummy']]);
|
||||
|
||||
// datetime
|
||||
$normalizer->normalize(Argument::type(\DateTimeImmutable::class), 'json', Argument::type('array'))
|
||||
@@ -231,6 +256,9 @@ class TicketNormalizerTest extends KernelTestCase
|
||||
// user
|
||||
$normalizer->normalize(Argument::type(User::class), 'json', Argument::type('array'))
|
||||
->willReturn(['user']);
|
||||
// person
|
||||
$normalizer->normalize(Argument::type(Person::class), 'json', Argument::type('array'))
|
||||
->willReturn(['person']);
|
||||
// motive
|
||||
$normalizer->normalize(Argument::type(Motive::class), 'json', Argument::type('array'))->willReturn(['type' => 'motive', 'id' => 0]);
|
||||
// person history
|
||||
|
||||
Reference in New Issue
Block a user