added tests for config ifsg_light_enabled
This commit is contained in:
parent
6b273288bd
commit
1ca9b99612
|
@ -255,9 +255,11 @@ function AngelType_view_members(AngelType $angeltype, $members, $admin_user_ange
|
|||
$member['has_license_12t_truck'] = icon_bool($member->license->drive_12t);
|
||||
$member['has_license_forklift'] = icon_bool($member->license->drive_forklift);
|
||||
}
|
||||
if ($angeltype->requires_ifsg_certificate) {
|
||||
if ($angeltype->requires_ifsg_certificate && config('ifsg_enabled')) {
|
||||
$member['ifsg_certificate'] = icon_bool($member->license->ifsg_certificate);
|
||||
$member['ifsg_certificate_light'] = icon_bool($member->license->ifsg_certificate_light);
|
||||
if (config('ifsg_light_enabled')) {
|
||||
$member['ifsg_certificate_light'] = icon_bool($member->license->ifsg_certificate_light);
|
||||
}
|
||||
}
|
||||
|
||||
if ($angeltype->restricted && empty($member->pivot->confirm_user_id)) {
|
||||
|
@ -363,7 +365,9 @@ function AngelType_view_table_headers(AngelType $angeltype, $supporter, $admin_a
|
|||
}
|
||||
|
||||
if (config('ifsg_enabled') && $angeltype->requires_ifsg_certificate && ($supporter || $admin_angeltypes)) {
|
||||
$headers['ifsg_certificate_light'] = __('ifsg.certificate_light');
|
||||
if (config('ifsg_light_enabled')) {
|
||||
$headers['ifsg_certificate_light'] = __('ifsg.certificate_light');
|
||||
}
|
||||
$headers['ifsg_certificate'] = __('ifsg.certificate');
|
||||
}
|
||||
|
||||
|
|
|
@ -582,8 +582,7 @@ class SettingsControllerTest extends ControllerTest
|
|||
*/
|
||||
public function testIfsgCertificate(): void
|
||||
{
|
||||
config(['ifsg_enabled' => true]);
|
||||
config(['ifsg_light_enabled' => true]);
|
||||
config(['ifsg_enabled' => true, 'ifsg_light_enabled' => true]);
|
||||
$this->setExpects($this->auth, 'user', null, $this->user, $this->once());
|
||||
|
||||
$this->response->expects($this->once())
|
||||
|
@ -629,8 +628,7 @@ class SettingsControllerTest extends ControllerTest
|
|||
*/
|
||||
public function testSaveIfsgCertificateLight(): void
|
||||
{
|
||||
config(['ifsg_enabled' => true]);
|
||||
config(['ifsg_light_enabled' => true]);
|
||||
config(['ifsg_enabled' => true, 'ifsg_light_enabled' => true]);
|
||||
$this->setExpects($this->auth, 'user', null, $this->user, $this->once());
|
||||
|
||||
$body = [
|
||||
|
@ -649,6 +647,32 @@ class SettingsControllerTest extends ControllerTest
|
|||
$this->assertEquals($this->user->license->ifsg_certificate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\SettingsController::saveIfsgCertificate
|
||||
*/
|
||||
public function testSaveIfsgCertificateLightWhileDisabled(): void
|
||||
{
|
||||
config(['ifsg_enabled' => true, 'ifsg_light_enabled' => false]);
|
||||
$this->setExpects($this->auth, 'user', null, $this->user, $this->once());
|
||||
$this->user->license->ifsg_certificate_light = false;
|
||||
$this->user->license->save();
|
||||
|
||||
$body = [
|
||||
'ifsg_certificate_light' => true,
|
||||
];
|
||||
$this->request = $this->request->withParsedBody($body);
|
||||
|
||||
$this->response->expects($this->once())
|
||||
->method('redirectTo')
|
||||
->with('http://localhost/settings/certificates')
|
||||
->willReturn($this->response);
|
||||
|
||||
$this->controller->saveIfsgCertificate($this->request);
|
||||
|
||||
$this->assertEquals($this->user->license->ifsg_certificate_light, false);
|
||||
$this->assertEquals($this->user->license->ifsg_certificate, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \Engelsystem\Controllers\SettingsController::saveIfsgCertificate
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue