feat(notification) : notifier les collaborateurs ajoutés à une tâche

This commit is contained in:
Matthieu
2026-06-15 11:45:01 +02:00
parent 390f2a40a8
commit 9e63f3d268
2 changed files with 46 additions and 0 deletions
@@ -115,6 +115,36 @@ class TaskNotificationListenerTest extends KernelTestCase
self::assertCount(0, $this->notifications->findBy(['user' => $this->alice]));
}
public function testAddingCollaboratorCreatesNotification(): void
{
$this->loginAs($this->actor);
$task = $this->makeTask();
$this->em->persist($task);
$this->em->flush();
$task->addCollaborator($this->alice);
$this->em->flush();
$rows = $this->notifications->findBy(['user' => $this->alice]);
self::assertCount(1, $rows);
self::assertSame('task_collaborator_added', $rows[0]->getType());
}
public function testAddingSelfAsCollaboratorCreatesNoNotification(): void
{
$this->loginAs($this->actor);
$task = $this->makeTask();
$this->em->persist($task);
$this->em->flush();
$task->addCollaborator($this->actor);
$this->em->flush();
self::assertCount(0, $this->notifications->findBy(['user' => $this->actor]));
}
private function makeUser(string $prefix): User
{
$user = new User();