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