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