. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Contracts\UserInterface; /** * Test the NoReplyUser class */ class NoReplyUserTest extends TestCase { protected static bool $uses_database = true; /** * @covers \Fisharebest\Webtrees\NoReplyUser::id * @covers \Fisharebest\Webtrees\NoReplyUser::email * @covers \Fisharebest\Webtrees\NoReplyUser::realName * @covers \Fisharebest\Webtrees\NoReplyUser::userName * @return void */ public function testConstructor(): void { $user = new NoReplyUser(); self::assertInstanceOf(UserInterface::class, $user); self::assertSame(0, $user->id()); self::assertSame('no-reply@localhost', $user->email()); self::assertSame(Webtrees::NAME, $user->realName()); self::assertSame('', $user->userName()); } /** * @covers \Fisharebest\Webtrees\NoReplyUser::getPreference * @covers \Fisharebest\Webtrees\NoReplyUser::setPreference * @return void */ public function testPreferences(): void { $user = new NoReplyUser(); self::assertSame('', $user->getPreference('foo')); self::assertSame('', $user->getPreference('foo')); self::assertSame('bar', $user->getPreference('foo', 'bar')); // No reply users do not have preferences $user->setPreference('foo', 'bar'); self::assertSame('', $user->getPreference('foo')); } }