mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-06 23:04:58 +00:00
Serialization of tickets with history
This commit is contained in:
@@ -11,8 +11,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\TicketBundle\Tests\Entity;
|
||||
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\TicketBundle\Entity\Motive;
|
||||
use Chill\TicketBundle\Entity\MotiveHistory;
|
||||
use Chill\TicketBundle\Entity\PersonHistory;
|
||||
use Chill\TicketBundle\Entity\Ticket;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
|
||||
@@ -31,7 +33,6 @@ class TicketTest extends KernelTestCase
|
||||
self::assertNull($ticket->getMotive());
|
||||
|
||||
$history = new MotiveHistory($motive, $ticket);
|
||||
$ticket->addMotiveHistory($history);
|
||||
|
||||
self::assertSame($motive, $ticket->getMotive());
|
||||
self::assertCount(1, $ticket->getMotiveHistories());
|
||||
@@ -39,9 +40,22 @@ class TicketTest extends KernelTestCase
|
||||
// replace motive
|
||||
$motive2 = new Motive();
|
||||
$history->setEndDate(new \DateTimeImmutable());
|
||||
$ticket->addMotiveHistory(new MotiveHistory($motive2, $ticket));
|
||||
$history2 = new MotiveHistory($motive2, $ticket);
|
||||
|
||||
self::assertCount(2, $ticket->getMotiveHistories());
|
||||
self::assertSame($motive2, $ticket->getMotive());
|
||||
}
|
||||
|
||||
public function testGetPerson(): void
|
||||
{
|
||||
$ticket = new Ticket();
|
||||
$person = new Person();
|
||||
|
||||
self::assertEquals([], $ticket->getPersons());
|
||||
|
||||
$history = new PersonHistory($person, $ticket, new \DateTimeImmutable('now'));
|
||||
|
||||
self::assertCount(1, $ticket->getPersons());
|
||||
self::assertSame($person, $ticket->getPersons()[0]);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user