mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 23:04:58 +00:00
Add api endpoint to open and close ticket
This commit is contained in:
@@ -114,25 +114,23 @@ class TicketTest extends KernelTestCase
|
||||
public function testGetState(): void
|
||||
{
|
||||
$ticket = new Ticket();
|
||||
$openState = new StateEnum(StateEnum::OPEN, ['en' => 'Open', 'fr' => 'Ouvert']);
|
||||
|
||||
// Initially, the ticket has no state
|
||||
self::assertNull($ticket->getState());
|
||||
|
||||
// Create a state history entry with the open state
|
||||
$history = new StateHistory($openState, $ticket);
|
||||
$history = new StateHistory(StateEnum::OPEN, $ticket);
|
||||
|
||||
// Verify that the ticket now has the open state
|
||||
self::assertSame($openState, $ticket->getState());
|
||||
self::assertSame(StateEnum::OPEN, $ticket->getState());
|
||||
self::assertCount(1, $ticket->getStateHistories());
|
||||
|
||||
// Change the state to closed
|
||||
$closedState = new StateEnum(StateEnum::CLOSED, ['en' => 'Closed', 'fr' => 'Fermé']);
|
||||
$history->setEndDate(new \DateTimeImmutable());
|
||||
$history2 = new StateHistory($closedState, $ticket);
|
||||
$history2 = new StateHistory(StateEnum::CLOSED, $ticket);
|
||||
|
||||
// Verify that the ticket now has the closed state
|
||||
self::assertCount(2, $ticket->getStateHistories());
|
||||
self::assertSame($closedState, $ticket->getState());
|
||||
self::assertSame(StateEnum::CLOSED, $ticket->getState());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user