period: fix method hasPreviousUser and create method isChangedUser, and use it in Notification

This commit is contained in:
2022-04-22 12:12:30 +02:00
parent f7d9551dc1
commit 2d9af8f8c0
3 changed files with 42 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Tests\Entity;
use ArrayIterator;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\User;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
@@ -62,6 +63,29 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertFalse($period->isClosingAfterOpening());
}
public function testHasChangedUser()
{
$period = new AccompanyingPeriod();
$this->assertFalse($period->isChangedUser());
$this->assertFalse($period->hasPreviousUser());
$period->setUser($user1 = new User());
$this->assertTrue($period->isChangedUser());
$this->assertFalse($period->hasPreviousUser());
$period->resetPreviousUser();
$this->assertFalse($period->isChangedUser());
$this->assertFalse($period->hasPreviousUser());
$period->setUser($user2 = new User());
$this->assertTrue($period->isChangedUser());
$this->assertTrue($period->hasPreviousUser());
$this->assertSame($user1, $period->getPreviousUser());
}
public function testHistoryLocation()
{
$period = new AccompanyingPeriod();