notification: more check in test

This commit is contained in:
Julien Fastré 2021-12-28 20:04:30 +01:00
parent b323ddae05
commit f453dbb543

View File

@ -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());
}
/**