. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use function str_repeat; /** * Test the site functions */ class SiteTest extends TestCase { protected static bool $uses_database = true; /** * @covers \Fisharebest\Webtrees\Site * * @return void */ public function testDefault(): void { self::assertSame('', Site::getPreference('no-such-setting')); self::assertSame('UTC', Site::getPreference('TIMEZONE')); } /** * @covers \Fisharebest\Webtrees\Site * * @return void */ public function testSetAndGetPreference(): void { Site::setPreference('setting', 'foo'); self::assertSame('foo', Site::getPreference('setting')); } /** * @covers \Fisharebest\Webtrees\Site * * @return void */ public function test2000CharacterLimit(): void { $too_long = str_repeat('x', 3000); $expected = str_repeat('x', 2000); Site::setPreference('setting', $too_long); self::assertSame($expected, Site::getPreference('setting')); } }