notification: add test for unread consistency

This commit is contained in:
2021-12-26 01:12:32 +01:00
parent bd3919efcb
commit 700bb02374
3 changed files with 31 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
<?php
namespace Entity;
use Chill\MainBundle\Entity\Notification;
use Chill\MainBundle\Entity\User;
use PHPUnit\Framework\TestCase;
class NotificationTest extends TestCase
{
public function testAddAddresseeStoreAnUread()
{
$notification = new Notification();
$notification->addAddressee($user1 = new User());
$notification->addAddressee($user2 = new User());
$this->assertCount(2, $notification->getAddressees());
$this->assertCount(2, $notification->getUnreadBy());
$this->assertContains($user1, $notification->getUnreadBy()->toArray());
$this->assertContains($user2, $notification->getUnreadBy()->toArray());
}
}