. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use function str_repeat; /** * Test the site functions */ class SiteTest extends TestCase { protected static $uses_database = true; /** * @covers \Fisharebest\Webtrees\Site * * @return void */ public function testDefault(): void { self::assertSame('foo', Site::getPreference('no-such-setting', 'foo')); self::assertSame('bar', Site::getPreference('no-such-setting', 'bar')); } /** * @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')); } }