diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php index 829d012a..4289e332 100644 --- a/src/Controllers/Admin/UserWorkLogController.php +++ b/src/Controllers/Admin/UserWorkLogController.php @@ -52,7 +52,7 @@ class UserWorkLogController extends BaseController } return $this->showEditWorklog($user, $worklog->worked_at, $worklog->hours, $worklog->comment, true); } else { - return $this->showEditWorklog($user, $this->getWorkDateSuggestion()); + return $this->showEditWorklog($user, Carbon::today()); } } @@ -145,16 +145,4 @@ class UserWorkLogController extends BaseController ] ); } - - private function getWorkDateSuggestion(): Carbon - { - $buildup_start = config('buildup_start'); - $event_start = config('event_start'); - - $work_date_suggestion = Carbon::today(); - if (!empty($buildup_start) && (empty($event_start) || $event_start->lessThan(Carbon::now()))) { - $work_date_suggestion = $buildup_start->startOfDay(); - } - return $work_date_suggestion; - } } diff --git a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php index e4598ee3..92bec537 100644 --- a/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php +++ b/tests/Unit/Controllers/Admin/UserWorkLogControllerTest.php @@ -60,29 +60,6 @@ class UserWorkLogControllerTest extends ControllerTest $this->controller->editWorklog($request); } - /** - * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog - * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::getWorkDateSuggestion - * - * @dataProvider buildupConfigsAndWorkDates - */ - public function testShowAddWorklogWithSuggestedWorkDate( - Carbon|null $buildup_start, - Carbon|null $event_start, - Carbon $suggested_work_date - ): void { - $request = $this->request->withAttribute('user_id', $this->user->id); - config(['buildup_start' => $buildup_start]); - config(['event_start' => $event_start]); - $this->response->expects($this->once()) - ->method('withView') - ->willReturnCallback(function (string $view, array $data) use ($suggested_work_date) { - $this->assertEquals($suggested_work_date, $data['work_date']); - return $this->response; - }); - $this->controller->editWorklog($request); - } - /** * @covers \Engelsystem\Controllers\Admin\UserWorkLogController::editWorklog */