19 declare(strict_types=1);
31 require_once __DIR__ .
'/bootstrap.php';
39 $this->assertInstanceOf(Settings::class,
new Settings($this->mock(SelectSetting::class)));
49 $this->
assertSelect(
'validateOnLogin',
'tos_reevaluate_on_login',
'boolean');
54 $this->
assertSelect(
'deleteUserOnWithdrawal',
'tos_withdrawal_usr_deletion',
'boolean');
59 $this->
assertSelect(
'adminEmail',
'admin_email',
'string');
69 $this->
assertSelect(
'lastResetDate',
'tos_last_reset',
'dateTime');
72 private function assertSelect(
string $method,
string $key,
string $type): void
74 $setting = $this->mock(Setting::class);
75 $convert = $this->mock(Convert::class);
77 $marshal = $this->mockMethod(Marshal::class, $type, [], $convert);
79 $settings = $this->mock(SelectSetting::class);
80 $settings->expects(self::once())->method(
'typed')->willReturnCallback(
function (
string $k, callable $select) use ($marshal, $convert,
$setting, $key) {
81 $this->assertSame($key, $k);
82 $this->assertSame($convert, $select($marshal));
testDeleteUserOnWithdrawal()
assertSelect(string $method, string $key, string $type)