diff --git a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php index 6343800d5..6bf966bbb 100644 --- a/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php +++ b/src/Bundle/ChillMainBundle/Tests/Entity/NotificationTest.php @@ -27,7 +27,7 @@ final class NotificationTest extends KernelTestCase { private array $toDelete = []; - protected function setUp() + protected function setUp(): void { self::bootKernel(); } @@ -70,15 +70,21 @@ final class NotificationTest extends KernelTestCase $notification->addAddressee($user1 = new User()); $notification->addAddressee($user2 = new User()); $notification->getAddressees()->add($user3 = new User()); + $notification->getAddressees()->add($user4 = new User()); - $this->assertCount(3, $notification->getAddressees()); + $this->assertCount(4, $notification->getAddressees()); // launch listener $notification->registerUnread(); - $this->assertCount(3, $notification->getUnreadBy()); + $this->assertCount(4, $notification->getUnreadBy()); $this->assertContains($user1, $notification->getUnreadBy()->toArray()); $this->assertContains($user2, $notification->getUnreadBy()->toArray()); $this->assertContains($user3, $notification->getUnreadBy()->toArray()); + + $notification->markAsReadBy($user1); + + $this->assertCount(3, $notification->getUnreadBy()); + $this->assertNotContains($user1, $notification->getUnreadBy()->toArray()); } /**